/* Player Container */
.webgames-player-wrapper {
    position: relative;
    margin-bottom: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.webgames-canvas-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.webgames-cover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #1a1c1e;
    /* M3 surface variant */
    transition: opacity 0.3s ease;
}

.wg-cover-bg {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background-size: cover;
    background-position: center;
    filter: blur(15px) brightness(0.6);
    z-index: 1;
    pointer-events: none;
}

.wg-cover-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.7) 100%);
}

.wg-cover-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    text-align: center;
}

.wg-cover-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-family: inherit;
    letter-spacing: 0.5px;
}

.wg-cover-thumb-wrapper {
    width: 200px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    /* Adjusted M3 shape for wider rectangle */
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    /* M3 elevation 3 */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wg-cover-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wg-cover-play-wrap {
    margin-top: 10px;
}

.webgames-play-btn {
    position: relative;
    z-index: 3;
    background: #ff4757;
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s, background 0.2s;
}

.webgames-play-btn:hover {
    transform: scale(1.05);
    background: #ff6b81;
}

.webgames-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 1;
}

/* Toolbar */
.webgames-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e272e;
    padding: 10px 15px;
    border-radius: 0 0 8px 8px;
    color: #fff;
}

.wg-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wg-thumb-container {
    width: 71px;
    height: 40px;
    position: relative;
}

.wg-thumb {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    object-fit: cover;
    display: block;
}

.wg-title {
    font-weight: 600;
    font-size: 16px;
}

.wg-toolbar-right {
    display: flex;
    gap: 8px;
}

/* ==========================================
   STYLE GUIDE: BUTTONS
   ========================================== */

/* 1. Primary Buttons (Action, Submit, Show More, WP Defaults) */
.wg-btn-primary,
.wg-btn-submit,
.wg-btn-show-more,
.wg-content-section input[type="submit"],
.wg-content-section button[type="submit"],
.wp-block-button__link {
    background-color: #2f3542;
    color: #ffffff;
    border: 1px solid #57606f;
    padding: 10px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    box-sizing: border-box;
}

.wg-btn-primary:hover,
.wg-btn-submit:hover,
.wg-btn-show-more:hover,
.wg-content-section input[type="submit"]:hover,
.wg-content-section button[type="submit"]:hover,
.wp-block-button__link:hover {
    background-color: #ff4757;
    border-color: #ff4757;
    color: #ffffff;
}

/* 2. Secondary / Icon Buttons (Player controls) */
.wg-btn {
    background: transparent;
    border: none;
    color: #d2dae2;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Custom Tooltip */
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.wg-toolbar-right [data-tooltip]::after {
    font-size: 10.4px;
}

.wg-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.wg-btn.active {
    color: #ff4757;
}

.wg-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================
   REPORT SIDEBAR FORM STYLES
   ========================================== */
.wg-report-body {
    padding: 20px;
}

.wg-report-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wg-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wg-form-group label {
    color: #a4b0be;
    font-size: 14px;
    font-weight: 600;
}

.wg-report-form textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #2f3542;
    border-radius: 8px;
    background: var(--m3-surface-container-high);
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: all 0.3s ease;
}

.wg-report-form textarea:focus {
    outline: none;
    border-color: #ff4757;
    background: var(--m3-surface-container-highest, #2B2F36);
}

.wg-char-count {
    font-size: 12px;
    color: #57606f;
    text-align: right;
}

.wg-report-form .wg-btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ff4757;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wg-report-form .wg-btn-submit:hover {
    background: #ff6b81;
    transform: translateY(-2px);
}

.wg-report-form .wg-btn-submit:disabled {
    background: #57606f;
    cursor: not-allowed;
    transform: none;
}

/* Sidebar List */
.webgames-sidebar-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-block-start: 0 !important;
    /* Override WP block layout flow margin */
}

.wg-sidebar-item {
    width: 100%;
    min-width: 0;
}

.wg-sidebar-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.wg-sidebar-thumb-container {
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16 / 9;
    background: #2f3542;
    border: 2px solid #232323;
}

.wg-sidebar-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.wg-game-card-rating {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 2;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.wg-game-card-rating .dashicons {
    color: #f1c40f;
    font-size: 12px;
    width: 12px;
    height: 12px;
    line-height: 12px;
}

.wg-sidebar-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 10px 10px;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    height: 100%;
    box-sizing: border-box;
    z-index: 2;
}

.wg-sidebar-title {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    line-height: 1.3;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.wg-game-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    gap: 8px;
    position: relative;
    transition: transform 0.3s ease;
}

.wg-game-card-info {
    padding: 0 4px;
    min-width: 0;
}

.wg-game-card-title {
    margin: 0;
    padding-block-end: 6px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0.8;
    text-transform: capitalize;
}

.wg-game-card-link {
    color: #fff;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wg-game-card-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
}

.wg-game-card a:focus {
    outline: none;
}

.wg-game-card:hover {
    transform: scale(1.1);
    z-index: 10;
    position: relative;
}

.wg-game-card:hover .wg-sidebar-thumb-container {
    border: 2px solid #ff4757;
}

.wg-game-card:hover .wg-sidebar-overlay {
    opacity: 1;
}

/* We removed the .wg-sidebar-thumb scale here */

.wg-sidebar-ad-wrapper {
    grid-column: 1 / -1;
    width: 100%;
    margin: 10px 0;
    text-align: center;
}

.wg-sidebar-ad-wrapper img,
.wg-sidebar-ad-wrapper iframe {
    width: 100%;
    max-width: 100%;
    height: auto;
}

/* Main Content & Comments Section */
.wg-content-section {
    background-color: #17181a;
    padding: 25px;
    border-radius: 8px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.wg-content-section .wp-block-post-title {
    /* Tăng title thêm ~10% so với bản trước (1.4->1.55, 1.8->2.0) */
    font-size: clamp(1.55rem, 2.5vw + 0.5rem, 2rem) !important;
    line-height: 1.3;
}

/* Thu nhỏ nội dung bài viết cho phù hợp với Title */
.wg-main-column .wg-content-section .wp-block-post-content,
.wg-main-column .wg-content-section .wp-block-post-content p,
.wg-main-column .wg-content-section .wp-block-post-content li,
.wg-main-column .wg-content-section .wp-block-post-content .has-text-color {
    font-size: clamp(0.8rem, 1.5vw + 0.4rem, 0.9rem) !important;
    line-height: 1.6;
    color: var(--wg-text-muted);
    /* Áp dụng màu xanh xám dịu mắt */
}

/* Đảm bảo các thẻ tiêu đề bên trong nội dung vẫn sáng để tạo phân cấp */
.wg-content-section .wp-block-post-content h1,
.wg-content-section .wp-block-post-content h2,
.wg-content-section .wp-block-post-content h3,
.wg-content-section .wp-block-post-content h4,
.wg-content-section .wp-block-post-content h5,
.wg-content-section .wp-block-post-content h6 {
    color: #ffffff;
}

/* Expandable Content */
.wg-expandable-content {
    position: relative;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
}

.wg-expandable-content.is-collapsed {
    max-height: 735px !important;
}

.wg-expandable-content.is-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(to bottom, transparent, #17181a);
    pointer-events: none;
}

.wg-show-more-container {
    text-align: center;
    margin-top: 20px;
    display: none;
    /* Hidden by default, JS handles display */
}



/* Related Games Grid */
.wg-related-grid-wrapper {
    margin-top: 30px;
    margin-bottom: 30px;
}

.wg-related-grid-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #fff;
    text-transform: uppercase;
}

.wg-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.wg-related-item {
    width: 100%;
    min-width: 0;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .wg-related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* Stack toolbar into 2 rows on mobile */
    .webgames-toolbar {
        flex-direction: column;
        gap: 15px;
        padding-top: 15px;
        padding-bottom: 15px;
    }

    .wg-toolbar-right {
        width: 100%;
        justify-content: space-between;
        /* Spread buttons evenly */
    }

    /* Hide cover title on small mobile screens to save space */
    .wg-cover-title {
        display: none;
    }
}

/* ==========================================
   TABLET RESPONSIVE OVERRIDE (For Game Layout)
   ========================================== */
@media (max-width: 991px) {

    /* Force Gutenberg columns to stack earlier than the WP default 781px */
    .wg-main-column .wp-block-columns {
        flex-wrap: wrap !important;
    }

    .wg-main-column .wp-block-columns>.wp-block-column {
        flex-basis: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 20px;
    }

    /* Ad-Safe Sidebar Grid: Must be a divisor of 4 to avoid orphaned cards before the Ad */
    .webgames-sidebar-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile fallback for Sidebar Ad-Safe Grid */
@media (max-width: 767px) {
    .webgames-sidebar-list {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ==========================================
   ARCHIVE / CATEGORY / TAG LAYOUT
   ========================================== */

.wg-archive-container {
    padding: 20px 0;
}

/* Archive Header */
.wg-archive-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.wg-archive-header-left {
    flex: 1 1 auto;
}

.wg-archive-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: #fff;
    text-transform: capitalize;
}

.wg-archive-desc {
    font-size: 14px;
    color: #a4b0be;
    max-width: 600px;
}

.wg-archive-header-right {
    flex: 0 0 auto;
}

.wg-sort-form label {
    margin-right: 10px;
    font-size: 14px;
    color: #a4b0be;
}

.wg-sort-form select {
    background-color: #2f3542;
    color: #fff;
    border: 1px solid #57606f;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

.wg-sort-form select:focus,
.wg-sort-form select:hover {
    border-color: #ff4757;
}

/* Archive Grid */
.wg-archive-grid-wrapper {
    display: grid;
    /* Responsive auto-fill: tries to fit as many 180px columns as possible */
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}



/* ==========================================
   OFF-CANVAS SHARE SIDEBAR
   ========================================== */
.wg-share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.wg-share-overlay.active {
    opacity: 1;
    visibility: visible;
}

.wg-share-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 100%;
    height: 100vh;
    background: #1e272e;
    color: #d2dae2;
    z-index: 10001;
    transform: translateX(100%);
    transition: transform 0.35s ease-out;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.wg-share-sidebar.active {
    transform: translateX(0);
}

.wg-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wg-share-header h3 {
    margin: 0;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
}

.wg-share-body {
    padding: 20px;
    overflow-y: auto;
}

.wg-share-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wg-share-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    text-align: left;
}

.wg-share-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.wg-share-btn .dashicons,
.wg-share-btn svg {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.wg-share-fb:hover {
    background: #1877F2;
}

.wg-share-x:hover {
    background: #000000;
    border: 1px solid #333;
}

.wg-share-instagram:hover {
    background: #E1306C;
}

.wg-share-tiktok:hover {
    background: #000000;
    border: 1px solid #333;
}

.wg-share-copy:hover {
    background: #ff4757;
}

.wg-share-native {
    display: none;
}

.wg-share-native:hover {
    background: #2ed573;
}

/* ==========================================
   WOOCOMMERCE STYLE TOAST NOTIFICATIONS
   ========================================== */
#wg-woo-toast-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: none;
    /* Let clicks pass through the container */
}

.wg-woo-toast {
    display: flex;
    align-items: stretch;
    background-color: #ffffff;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    pointer-events: auto;
    /* Re-enable clicks on the toast itself */
    transform: translateY(100px) scale(0.9);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 280px;
    max-width: 350px;
    border-left: 4px solid #ff4757;
}

.wg-woo-toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.wg-woo-toast-thumb {
    width: 80px;
    aspect-ratio: 4/3;
    flex-shrink: 0;
    background-color: #f1f2f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wg-woo-toast-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wg-woo-toast-content {
    padding: 12px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.wg-woo-toast-status {
    font-size: 13px;
    color: #2ed573;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.wg-woo-toast-status::before {
    content: '\f147';
    font-family: 'dashicons';
    font-size: 16px;
}

.wg-woo-toast-title {
    font-size: 14px;
    color: #2f3542;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Pagination */
.wg-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
}

.wg-pagination a,
.wg-pagination span.current {
    background-color: #2f3542;
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid #57606f;
}

.wg-pagination a:hover {
    background-color: #ff4757;
    border-color: #ff4757;
}

.wg-pagination span.current {
    background-color: #ff4757;
    border-color: #ff4757;
}

.wg-bottom-seo {
    margin-top: 40px;
    margin-bottom: 20px;
    padding: 30px;
    background-color: #17181a;
    border-radius: 8px;
}

.wg-bottom-seo p,
.wg-bottom-seo ol,
.wg-bottom-seo li {
    font-size: clamp(0.8rem, 1.5vw + 0.4rem, 0.9rem) !important;
    line-height: 1.6;
    color: var(--wg-text-muted);
}

/* ==========================================
   FULLSCREEN MODE (OPTION 2)
   ========================================== */


.webgames-canvas-container:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    background: #000 !important;
}

.webgames-canvas-container:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    background: #000 !important;
}

/* Mobile Archive Responsive */
@media (max-width: 576px) {
    .wg-archive-grid-wrapper {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }


}

/* All Tags Page Layout */
.wg-all-tags-container {
    padding: 20px 0;
}

.wg-tags-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(164, 176, 190, 0.2);
}

.wg-tags-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(164, 176, 190, 0.1);
    color: #a4b0be;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s ease;
}

.wg-tags-nav a:hover,
body.dark-mode .wg-tags-nav a:hover {
    background: #FF4757;
    color: #fff;
    transform: translateY(-2px);
}

.wg-tag-group {
    margin-bottom: 40px;
    scroll-margin-top: 80px;
    /* Offset for fixed headers if any */
}

.wg-tag-letter {
    font-size: 24px;
    margin-bottom: 15px;
    color: #2f3542;
    padding-bottom: 5px;
    border-bottom: 2px solid #FF4757;
    display: inline-block;
}

body.dark-mode .wg-tag-letter {
    color: #fff;
}

.wg-tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.wg-tag-grid li a {
    display: block;
    padding: 12px 15px;
    background: rgba(164, 176, 190, 0.05);
    border: 1px solid rgba(164, 176, 190, 0.1);
    border-radius: 8px;
    color: #2f3542;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-mode .wg-tag-grid li a {
    color: #f1f2f6;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.wg-tag-grid li a:hover {
    background: #fff;
    border-color: rgba(255, 71, 87, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    color: #FF4757;
    transform: translateY(-2px);
}

body.dark-mode .wg-tag-grid li a:hover {
    background: rgba(255, 71, 87, 0.1);
    border-color: rgba(255, 71, 87, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.wg-tag-count {
    color: #a4b0be;
    font-size: 13px;
    font-weight: normal;
}

.wg-tag-grid li a:hover .wg-tag-count {
    color: #FF4757;
}

/* ==========================================
   IOS PSEUDO-FULLSCREEN FALLBACK
   ========================================== */
html.wg-pseudo-fullscreen-html,
body.wg-pseudo-fullscreen-body {
    overflow: hidden;
}

.wg-pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    background: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

.wg-pseudo-fullscreen .webgames-canvas-container {
    flex: 1 !important;
    width: 100% !important;
    height: 0 !important; /* Forces flex to calculate height dynamically */
    aspect-ratio: auto !important;
    border-radius: 0 !important;
}

.wg-pseudo-fullscreen .webgames-toolbar {
    border-radius: 0 !important;
    margin: 0 !important;
    flex-direction: row;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 0;
}

.wg-pseudo-fullscreen .wg-toolbar-right {
    width: auto;
    justify-content: flex-end;
}

.wg-pseudo-fullscreen iframe {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

@media (max-width: 768px) {
    .wg-pseudo-fullscreen .webgames-toolbar {
        order: -1;
        padding-top: max(10px, env(safe-area-inset-top));
    }

    .wg-pseudo-fullscreen .webgames-toolbar .wg-btn-like,
    .wg-pseudo-fullscreen .webgames-toolbar .wg-btn-dislike,
    .wg-pseudo-fullscreen .webgames-toolbar .wg-btn-fav,
    .wg-pseudo-fullscreen .webgames-toolbar .wg-btn-share,
    .wg-pseudo-fullscreen .webgames-toolbar .wg-btn-report {
        display: none !important;
    }
}

/* ==========================================
   LOADING TOAST NOTIFICATION (M3 Style)
   ========================================== */
.wg-toast-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.wg-toast {
    background: #2b2f36; /* M3 surface container high */
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4); /* M3 elevation 2 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wg-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.wg-toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.wg-toast-message {
    flex: 1;
}

.wg-toast-close {
    background: transparent;
    border: none;
    color: #a4b0be;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
}

.wg-toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}