/* ============================================
   TAILWIND CUSTOM CSS
   Styles that cannot be handled by Tailwind
   ============================================ */

/* UVN Font Face - Must be in CSS file */
@font-face {
    font-family: "UVN";
    src: url("../UVN-Phuong-Tay.ttf");
    font-display: swap;
}

/* Quicksand Font Class */
.font-quicksand {
    font-family: "Quicksand", sans-serif !important;
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */

/* Shimmer effect for buttons */
.btn-shimmer {
    position: relative;
    overflow: hidden;
}

.btn-shimmer::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s;
}

.btn-shimmer:hover::before {
    left: 100%;
}

/* ============================================
   SCREENSHOT FUNCTIONALITY
   ============================================ */

/* Screenshot mode class */
.screenshot-mode {
    display: block !important;
    width: auto !important;
    height: auto !important;
}

/* Screenshot message notification */
.screenshot-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    font-weight: 600;
    color: white;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.screenshot-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   FULLSCREEN MODE
   ============================================ */

body.fullscreen-mode {
    position: fixed;
    inset: 0;
    overflow: auto;
    z-index: 9999;
    background: white;
}

body.fullscreen-mode .save-screenshot-container,
body.fullscreen-mode .fullscreen-toggle-btn {
    display: none !important;
}

/* ============================================
   LOADING STATES
   ============================================ */

.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Spin animation for loading indicators */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ============================================
   SAVE SCREENSHOT BUTTON
   ============================================ */

.save-screenshot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}

.save-screenshot-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffd166 0%, #f4b400 100%);
    border: none;
    color: #2c1810;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.2);
    transition: all 0.3s ease;
}

.save-screenshot-btn:hover {
    filter: brightness(0.95);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.3);
}

.save-screenshot-btn:active {
    transform: translateY(0);
}

/* ============================================
   FULLSCREEN TOGGLE BUTTON
   ============================================ */

.fullscreen-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 100px;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-toggle-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.fullscreen-toggle-btn svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   GRID CELL SPECIAL EFFECTS
   ============================================ */

/* Colored border overlay for grid cells (if needed later) */
.grid-cell.has-colored-border::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

/* Ensure content is above overlay */
.grid-cell > * {
    position: relative;
    z-index: 2;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .save-screenshot-container {
        bottom: 10px;
        right: 10px;
    }

    .fullscreen-toggle-btn {
        bottom: 10px;
        right: 70px;
    }

    .save-screenshot-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* ============================================
   FOOTER COMPONENT
   ============================================ */

.footer {
    background-color: transparent !important;
    display: flex;
    justify-content: start;
    align-items: center;
    padding: 14px 0;
}

.footer-left {
    color: #6b7280;
    font-size: 14px;
}

.footer-left a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-left a:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* ============================================
   SIMPLE MODAL (popup_cachcuc.blade.php)
   For rect-btn, oval-btn, and cell-title elements
   ============================================ */

.simple-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(0, 0, 0, 0.5);
}

.simple-modal-overlay.active {
    display: flex;
    opacity: 1;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.simple-modal-container {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    transition: opacity 0.3s ease;
    overflow: hidden;
}

.simple-modal-overlay.active .simple-modal-container {
    transform: translateY(0) !important;
}

.simple-modal-header {
    padding: 24px 28px 20px 28px;
    border-bottom: 2px solid #f0e68c;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f5f5dc 0%, #deb887 100%);
    position: relative;
}

.simple-modal-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c1810;
    margin: 0;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.1));
}

.simple-modal-close {
    background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
    border: 2px solid #8b4513;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: #2c1810;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.simple-modal-close:hover {
    background: linear-gradient(135deg, #b8860b 0%, #d4af37 100%);
}

.simple-modal-content {
    padding: 28px;
    flex: 1;
    overflow: auto;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
}

.simple-modal-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #2c1810;
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.1);
    font-weight: 500;
}

/* Popup Section Styles */
.popup-section {
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border-left: 4px solid #d4af37;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.1);
    text-align: left;
}

.popup-section strong {
    color: #8b4513;
    font-size: 1.05rem;
    display: block;
    margin-bottom: 8px;
}

.popup-section p {
    color: #2c1810;
    line-height: 1.6;
    margin: 0;
    font-size: 1rem;
}

/* Mobile responsive for simple modal */
@media (max-width: 768px) {
    .simple-modal-container {
        margin: 10px;
        max-width: calc(100% - 20px);
        border-radius: 12px;
    }

    .simple-modal-header {
        padding: 20px 24px 16px 24px;
    }

    .simple-modal-title {
        font-size: 1.2rem;
    }

    .simple-modal-close {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    .simple-modal-content {
        padding: 24px;
    }

    .simple-modal-description {
        font-size: 1rem;
        padding: 16px;
    }
}

/* ============================================
   POPUP OVERLAY (popup_detail.blade.php)
   For cell details popup (hamburger menu)
   ============================================ */

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
}

.popup-overlay.active {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 1;
    padding: 0;
}

/* Popup Container - Mobile First */
.popup-container {
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}

.popup-overlay.active .popup-container {
    transform: translateY(0);
}

/* Popup Header */
.popup-header {
    padding: 20px 20px 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    position: relative;
    flex-shrink: 0;
}

.popup-header::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
}

.popup-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.popup-close {
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Palace Info Section */
.palace-info {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.palace-info-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 4px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    min-height: 50px;
}

.palace-info-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.palace-info-value {
    color: #dc2626;
    font-weight: 700;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
}

/* Main Tabs */
.popup-tabs {
    display: flex;
    background: white;
    padding: 0 20px;
    border-bottom: 1px solid #f0f0f0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
}

.popup-tabs::-webkit-scrollbar {
    display: none;
}

.popup-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.popup-tab.active {
    color: #dc2626;
    border-bottom-color: #dc2626;
}

.popup-tab:hover {
    color: #374151;
}

/* Popup Content */
.popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Sub Tabs */
.sub-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sub-tab {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sub-tab.active {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

.sub-tab:hover {
    border-color: #dc2626;
    color: #dc2626;
}

.sub-tab.active:hover {
    color: white;
}

/* Sub Content */
.sub-content {
    display: none;
}

.sub-content.active {
    display: block;
}

/* Popup Table */
.popup-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.popup-table thead {
    background: #f8f9fa;
}

.popup-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.85rem;
    border-bottom: 2px solid #e9ecef;
}

.popup-table td {
    padding: 12px;
    color: #1f2937;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
}

.popup-table tbody tr:last-child td {
    border-bottom: none;
}

.popup-table tbody tr:hover {
    background: #f8f9fa;
}

/* Description Area */
.description-area {
    margin-top: 16px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #dc2626;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #374151;
}

/* Two Section Layout */
.two-section-layout {
    display: grid;
    gap: 20px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

/* Mobile Responsive for Popup Tables */
@media (max-width: 768px) {
    .palace-info {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 10px;
    }

    .palace-info-item {
        padding: 8px 4px;
        min-height: 40px;
    }

    .palace-info-value {
        font-size: 1em;
    }

    .popup-tabs {
        padding: 0 10px;
    }

    .popup-tab {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .popup-content {
        padding: 15px;
    }

    .popup-table {
        display: block;
        overflow-x: auto;
    }

    .popup-table thead {
        display: none;
    }

    .popup-table tbody,
    .popup-table tr,
    .popup-table td {
        display: block;
    }

    .popup-table tr {
        margin-bottom: 15px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        overflow: hidden;
    }

    .popup-table td {
        padding: 10px;
        text-align: right;
        position: relative;
        padding-left: 50%;
        border-bottom: 1px solid #f0f0f0;
    }

    .popup-table td:last-child {
        border-bottom: none;
    }

    .popup-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: 600;
        color: #6b7280;
        text-align: left;
    }

    .sub-tabs {
        gap: 6px;
    }

    .sub-tab {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .description-area {
        padding: 12px;
        font-size: 0.85rem;
    }

    .section-title {
        font-size: 0.9rem;
    }
}

/* ============================================
   MAIN GRID STYLES WITH TAILWIND VALUES
   Keep class names for JavaScript compatibility
   ============================================ */

/* Main Grid Container */
.main-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

/* Grid Cells */
.grid-cell {
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.8),
        rgba(253, 245, 218, 0.8)
    );
    backdrop-filter: blur(4px);
    width: 100%;
    min-height: 180px;
    padding: 15px;
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    font-family: "Quicksand", sans-serif;
    font-size: 18px;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(247, 215, 116, 0.3);
}
.main-grid .grid-cell {
    aspect-ratio: 354 / 203;
    min-height: 200px;
}

.grid-cell:hover {
    box-shadow: 0 0 25px rgba(247, 215, 116, 0.4);
}

.grid-cell:active {
    transform: scale(0.95);
}

/* Golden Corner Decorations */
.grid-cell::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(
        to bottom right,
        rgba(247, 215, 116, 0),
        rgba(247, 215, 116, 0),
        rgba(247, 215, 116, 0)
    );
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.grid-cell:hover::before {
    background: linear-gradient(
        to bottom right,
        rgba(247, 215, 116, 0.1),
        rgba(247, 215, 116, 0.05),
        rgba(247, 215, 116, 0.1)
    );
}

/* Corner Decorations - All 4 corners with lines and diamonds */
.grid-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background:
        /* Top-left corner */
        linear-gradient(to right, #f7d774 0%, transparent 100%) top 4px left
            4px / 16px 1px no-repeat,
        linear-gradient(to bottom, #f7d774 0%, transparent 100%) top 4px left
            4px / 1px 16px no-repeat,
        /* Top-right corner */
            linear-gradient(to left, #f7d774 0%, transparent 100%) top 4px right
            4px / 16px 1px no-repeat,
        linear-gradient(to bottom, #f7d774 0%, transparent 100%) top 4px right
            4px / 1px 16px no-repeat,
        /* Bottom-left corner */
            linear-gradient(to right, #f7d774 0%, transparent 100%) bottom 4px
            left 4px / 16px 1px no-repeat,
        linear-gradient(to top, #f7d774 0%, transparent 100%) bottom 4px left
            4px / 1px 16px no-repeat,
        /* Bottom-right corner */
            linear-gradient(to left, #f7d774 0%, transparent 100%) bottom 4px
            right 4px / 16px 1px no-repeat,
        linear-gradient(to top, #f7d774 0%, transparent 100%) bottom 4px right
            4px / 1px 16px no-repeat,
        /* Corner diamonds */
            radial-gradient(
                circle at center,
                #f7d774 0%,
                #f7d774 50%,
                transparent 50%
            )
            top 2px left 2px / 6px 6px no-repeat,
        radial-gradient(
                circle at center,
                #f7d774 0%,
                #f7d774 50%,
                transparent 50%
            )
            top 2px right 2px / 6px 6px no-repeat,
        radial-gradient(
                circle at center,
                #f7d774 0%,
                #f7d774 50%,
                transparent 50%
            )
            bottom 2px left 2px / 6px 6px no-repeat,
        radial-gradient(
                circle at center,
                #f7d774 0%,
                #f7d774 50%,
                transparent 50%
            )
            bottom 2px right 2px / 6px 6px no-repeat;
    transform: rotate(0deg);
}

/* Rotate diamonds effect using clip-path on a separate layer */
.grid-cell .corner-diamond {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #f7d774;
    transform: rotate(45deg);
    pointer-events: none;
    z-index: 3;
}

.grid-cell .corner-diamond.top-left {
    top: 2px;
    left: 2px;
}

.grid-cell .corner-diamond.top-right {
    top: 2px;
    right: 2px;
}

.grid-cell .corner-diamond.bottom-left {
    bottom: 2px;
    left: 2px;
}

.grid-cell .corner-diamond.bottom-right {
    bottom: 2px;
    right: 2px;
}

.grid-cell.center {
    background: #5a1d1f url("/assets/kmdg/img/logo.png") no-repeat
        center/contain;
}

/* Icons */
.horse-icon {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(to bottom right, #fef08a, #ca8a04);
    border-radius: 0.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
    z-index: 5;
}

.kv-icon {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(to bottom right, #fef08a, #ca8a04);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: #2c1810;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
    z-index: 5;
}

.kv-icon:empty {
    display: none;
}

/* When both horse and kv icons exist */
.grid-cell .horse-icon ~ .kv-icon {
    right: 45px;
}

.cell-icons {
    display: flex;
    gap: 0.5rem;
    position: absolute;
    top: 0.625rem;
    left: 0.625rem;
    z-index: 10;
}

.cell-icons .icon {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: linear-gradient(to bottom right, #facc15, #a16207);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s;
    border: 0;
    color: #2c1810;
    font-weight: bold;
}

.cell-icons .icon:hover {
    background: linear-gradient(to bottom right, #a16207, #facc15);
}

/* Cell Header */
.cell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.5rem;
    position: relative;
    z-index: 2;
}

.cell-title {
    font-family: "Quicksand", serif;
    font-size: 32px;
    font-weight: bold;

    text-align: center;
    flex-grow: 1;
    cursor: pointer;
    transition: color 0.3s ease;
}

.cell-title:hover {
    color: #f7d774;
}

.grid-cell .title {
    font-size: 28px;
    font-weight: bold;
}

/* Cell Content */
.cell-content {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    overflow: visible;
    flex-wrap: wrap;
    padding: 0.125rem;
    position: relative;
    z-index: 2;
}

/* Buttons Layout */
.left-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 0.375rem;
    flex: 1;
    overflow: visible;
    max-height: 100%;
    max-width: 120px;
}

.left-buttons .rect-btn:nth-child(1) {
    grid-column: span 1;
    grid-row: span 1;
}

.left-buttons .rect-btn:nth-child(2) {
    grid-column: span 2;
    grid-row: span 1;
}

.left-buttons.has-new .rect-btn:nth-child(2) {
    grid-column: span 1 !important;
}

.left-buttons .rect-btn:nth-child(3) {
    grid-column: span 2;
    grid-row: span 1;
}

.right-buttons {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.375rem;
    flex: 1;
    overflow: visible;
    max-height: 100%;
    max-width: 100%;
}

/* Button Styles */
.rect-btn {
    background: transparent;

    border-radius: 0.5rem;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    cursor: pointer;
    transition: all 0.3s;
    border: 0;
    position: relative;
    overflow: visible;
}

.oval-btn {
    background: transparent;

    border-radius: 0.5rem;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    cursor: pointer;
    transition: all 0.3s;
    border: 0;
    position: relative;
    overflow: visible;
}

.rect-btn .title,
.oval-btn .title {
    font-size: 1.5rem;
    font-weight: bold;

    white-space: nowrap;
    overflow: visible;
}

/* Center Buttons */
.center-buttons {
    width: 100%;
    text-align: center;
}

/* KKM Result */
.KKMresult {
    width: 112%;
    font-family: "system-ui";
    font-size: 15px;
    color: white;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.7));
    line-height: 1.3;
    z-index: 5;
    text-align: center;
    padding: 0.375rem;
    margin-top: 0.375rem;
    background: #8b4545b0;
    border-radius: 0.25rem;
    position: absolute;
    bottom: -15px;
}

/* Hidden by default - will be shown when has content */
.KKMresult:empty {
    display: none;
}

/* Center Cell Specific */
.yin-yang-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    opacity: 0.15;
    z-index: 0;
    border: 0;
}

.center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    gap: 2.5rem;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.center-left,
.center-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.center-item {
    font-size: 1rem;
    color: #78350f;
    text-align: center;
    font-weight: 600;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.2));
}

/* ============================================
   DISPLAY NONE OVERRIDES
   Critical for JavaScript functionality
   ============================================ */

/* Hide rect-btn with .hide class */
.rect-btn.hide {
    display: none !important;
}

/* Utility classes for JavaScript */
.flex {
    display: flex !important;
}

.hidden {
    display: none !important;
}

/* Hide horse-icon by default (shown via JS) */
.hourse-icon {
    display: none;
}

/* Hide center-right items by default */
.center-right .center-item {
    display: none;
}

/* Show center title and type */
.center-left .center-title-text,
.center-right .center-type-text {
    display: block !important;
    font-size: 2rem;
    font-weight: 700;
    color: #fef08a;
    text-align: center;
    font-family: "Quicksand", sans-serif !important;
    position: relative;
    z-index: 10;
    position: absolute;
    left: 0;
    width: 20%;
    top: 50%;
    transform: translateY(-50%);
}
.center-left .center-title-text {
    left: 3%;
}
.center-right .center-type-text {
    right: -65%;

    transform: translateX(370%) translateY(-50%);
}
/* Hide specific center-left items */
.center-left #center-year,
.center-left #center-month,
.center-left #center-day,
.center-left #center-hour,
.center-left #center-cam {
    display: none;
}

/* Container-specific display rules */
/* Đảm bảo tất cả các loại kỳ môn có cùng width */
.container.kymon,
.container.cachcuc,
.container.kmdg,
.container.kmm,
.container.kmab {
    max-width: 1200px !important;
    width: 100% !important;
}

/* Đảm bảo main-grid có width nhất quán cho tất cả các loại kỳ môn */
.container.kymon .main-grid,
.container.cachcuc .main-grid,
.container.kmdg .main-grid,
.container.kmm .main-grid,
.container.kmab .main-grid {
    width: 100% !important;
}

.container.kymon .center-buttons {
    display: none;
}

.container.cachcuc .rect-btn,
.container.cachcuc .oval-btn {
    display: none;
}

.container.cachcuc .cell-title {
    display: none;
}

/* Hide first child of center-buttons */
.center-buttons > *:first-child {
    display: none;
}

/* Responsive: Hide button shimmer effect on mobile */
@media (max-width: 768px) {
    .rect-btn::before,
    .oval-btn::before {
        display: none;
    }

    .cell-content {
        height: auto;
        padding: 2px;
        gap: 2px;
        flex-wrap: wrap;
    }
}

/* ============================================
   MOBILE RESPONSIVE (max-width: 500px)
   ============================================ */
@media (max-width: 500px) {
    .grid-cell .title {
        font-size: 11px !important;
    }

    .kv-icon,
    .horse-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
        top: 2px;
        right: 2px;
    }

    .grid-cell .horse-icon ~ .kv-icon {
        right: 24px;
    }

    .cell-icons {
        top: 2px;
        left: 2px;
        gap: 3px;
    }

    .cell-icons .icon {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }

    .rect-btn .title,
    .oval-btn .title {
        font-size: 10px !important;
    }

    .grid-cell {
        min-height: 80px !important;
        padding: 10px !important;
        aspect-ratio: 1;
        font-size: 11px;
        border-radius: 0;
        overflow: hidden;
        background: none !important;
    }

    /* Border decoration for mobile */
    .grid-cell::before {
        content: "";
        position: absolute;
        inset: 0;
        border: 14px solid transparent;
        border-image-source: url("../bg1.svg");
        border-image-slice: 30 fill;
        border-image-width: 14px;
        border-image-repeat: round;
        pointer-events: none;
        z-index: 0;
    }

    .grid-cell.has-colored-border::after {
        content: "";
        position: absolute;
        inset: 0;
        border: 14px solid transparent;
        border-image-source: var(--border-svg, url("../bg1_1.svg"));
        border-image-slice: 30 fill;
        border-image-repeat: round;
        pointer-events: none;
        z-index: 1;
    }

    .grid-cell > * {
        position: relative;
        z-index: 2;
    }

    .rect-btn,
    .oval-btn {
        min-height: 30px !important;
        padding: 3px 6px !important;
        font-size: 10px !important;
    }

    .main-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0;
        padding: 2px;
    }
}
