* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #dee2e6 100%);
    color: #343a40;
}

a {
    text-decoration: none;
    color: inherit;
}

a:hover {
    color: #cc0000;
}

.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 6px 24px rgba(0,0,0,0.1);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 12px;
    background: linear-gradient(90deg, #495057, #343a40);
    color: #fff;
    box-shadow: 0 4px 8px rgba(52, 58, 64, 0.3);
    border-bottom: 2px solid #6c757d;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar .brand-logo {
    width: 64px;
    height: 64px;
    background: radial-gradient(circle at center, #fff, #ffe5e5 65%, rgba(255,255,255,0.05));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: #b40000;
    text-transform: uppercase;
}

.topbar .brand h1 {
    margin: 0;
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.topbar .brand span {
    font-size: 13px;
    opacity: 0.9;
}

.topbar .cta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.topbar .cta a {
    border: 1px solid rgba(255,255,255,0.7);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    transition: background 0.2s;
}

.topbar .cta a:hover {
    background: rgba(255,255,255,0.12);
}

.banner {
    background: linear-gradient(45deg, #6c757d, #495057);
    padding: 14px 24px;
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
    position: relative;
}

.banner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(255,255,255,0.1) 2px,
        rgba(255,255,255,0.1) 4px
    );
}

.banner img {
    width: 100%;
    height: auto;
    border-radius: 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.navbar {
    display: flex;
    align-items: center;
    background: #b60000;
    padding: 0 24px;
    gap: 16px;
}

.navbar ul {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar li a {
    display: block;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    text-transform: uppercase;
}

.navbar li a:hover,
.navbar li a.active {
    background: rgba(0,0,0,0.25);
    border-radius: 4px 4px 0 0;
}

.layout {
    display: grid;
    grid-template-columns: 260px 1fr 240px;
    gap: 24px;
    padding: 24px;
}

.sidebar {
    background: #f7f7f7;
    border: 1px solid #dedede;
    border-radius: 0;
    padding: 16px;
}

.sidebar h2 {
    font-size: 16px;
    text-transform: uppercase;
    margin: 0 0 12px;
    color: #b30000;
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar ul li {
    margin-bottom: 8px;
    font-size: 14px;
    color: #444;
}

.sidebar ul li span.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    text-transform: uppercase;
    color: #777;
}

.sidebar .promo-banner {
    margin-top: 12px;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sidebar .promo-banner img {
    width: 100%;
    display: block;
}

.sidebar .legend {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e2e2;
    font-size: 13px;
    color: #666;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, #b60000, #930000);
    color: #fff;
    padding: 14px 18px;
    border-radius: 6px 6px 0 0;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.section { 
    border: 1px solid #dcdcdc;
    border-radius: 0;
    background: #fff;
    overflow: hidden;
}

.section-body {
    padding: 18px;
}

.live-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-status img {
    width: 32px;
    height: 32px;
}

.live-status strong {
    font-size: 18px;
    text-transform: uppercase;
}

.table-live {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.table-live thead th {
    background: #f8f3f3;
    padding: 10px;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 2px solid #d8c0c0;
}

.table-live tbody th {
    width: 140px;
    text-align: left;
    padding: 6px 10px; /* Reduced vertical padding to match td */
    font-weight: 600;
    background: #faf5f5;
    border-bottom: 1px solid #eee;
}

.table-live tbody td {
    padding: 6px 10px; /* Reduced vertical padding to make rows shorter */
    border-bottom: 1px solid #eee;
    font-weight: 600;
    letter-spacing: 1px;
    font-size: 21px; /* Updated to 21px as requested */
}

.table-live tbody tr.released td {
    color: #c30606;
}

/* Override for first to sixth prizes to be black when released */
.table-live tbody tr.first.released td,
.table-live tbody tr.giai_nhat.released td,
.table-live tbody tr.giai_nhi.released td,
.table-live tbody tr.giai_ba.released td,
.table-live tbody tr.giai_tu.released td,
.table-live tbody tr.giai_nam.released td,
.table-live tbody tr.giai_sau.released td {
    color: #000;
}

.table-live tbody tr.pending td {
    color: #666;
}

.table-live tbody tr.released th {
    color: #b10404;
}

.table-live.styled {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Arial', sans-serif;
    font-size: 16px;
    border: 2px solid #b9b9b9;
    table-layout: fixed;
}

.table-live.styled tbody tr th,
.table-live.styled tbody tr td {
    border: 1px solid #b9b9b9;
    padding: 8px; /* Reduced from 14px to make rows shorter */
    text-align: center;
    background: #fff;
    font-weight: 600;
    width: auto;
    font-size: 21px; /* Updated to 21px as requested */
    height: auto; /* Ensure consistent height */
    min-height: 30px; /* Set minimum height */
}

.table-live.styled tbody tr th {
    width: 140px;
    background: #f4f4f4;
    text-transform: uppercase;
    font-size: 14px;
    padding: 8px; /* Keep consistent with td padding */
}

/* Remove borders between cells, keeping only outside borders */
.table-live.styled tbody tr td {
    border-left: none;
    border-right: none;
    border-top: 1px solid #b9b9b9;
    border-bottom: 1px solid #b9b9b9;
}

/* Keep left border on first cell and right border on last cell */
.table-live.styled tbody tr td:first-child {
    border-left: 1px solid #b9b9b9;
}

.table-live.styled tbody tr td:last-child {
    border-right: 1px solid #b9b9b9;
}

.table-live.styled tbody tr:nth-child(even) td {
    background: #f6f6f6;
}

.table-live.styled tbody tr.grand td {
    font-size: 36px; /* Increased from 32px */
    color: #900;
}

.table-live.styled tbody tr.first td {
    font-size: 28px; /* Increased from 24px */
    color: #333;
}

.table-live.styled tbody tr.bottom td {
    color: #900;
    font-size: 24px; /* Increased from 20px */
}

/* Style for giai_bay blocks */
.giai_bay_blocks {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

.giai_bay_block {
    display: inline-block;
    flex: 1;
    text-align: center;
    margin: 0;
    padding: 4px 0; /* Reduced to match the new row height */
    font-weight: 600; 
    font-size: 21px; /* Same as other numbers */
    border: none; /* Remove border */
    background: none; /* Remove background */
    min-height: 30px;
}

/* Ensure loading spinners are properly aligned */
.giai_bay_block .loading-spinner {
    vertical-align: middle;
}

.live-table-wrapper {
    margin-top: 18px;
}

.live-table-wrapper .live-meta.below {
    margin-top: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    background: #ffeaea;
    color: #b30000;
}

.badge img {
    width: 16px;
    height: 16px;
}

.live-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: #666;
}

.live-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.card {
    background: #f8f8f8;
    border: 1px solid #e3e3e3;
    border-radius: 0;
    padding: 16px;
    min-height: 120px;
}

.card h3 {
    margin-top: 0;
    font-size: 15px;
    text-transform: uppercase;
    color: #b10404;
}

.card p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.sidebar-right {
    background: #fff7e6;
    border: 1px solid #f0d4a5;
    border-radius: 0;
    padding: 16px;
}

.sidebar-right h2 {
    margin-top: 0;
    font-size: 16px;
    color: #b30000;
}

.sidebar-right .sidebar-list {
    list-style: disc inside;
    margin: 12px 0;
    padding: 0;
    color: #5a4b30;
    font-size: 13px;
}

.sidebar-right .sidebar-list li {
    margin-bottom: 8px;
}

.banner-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.banner-stack img {
    width: 100%;
    border-radius: 0;
}

.footer {
    background: linear-gradient(90deg, #495057, #343a40);
    color: #fff;
    padding: 24px;
    text-align: center;
    font-size: 13px;
    box-shadow: 0 -2px 4px rgba(52, 58, 64, 0.2);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.footer a {
    color: #ffe2e2;
}

@media (max-width: 1024px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar, .sidebar-right {
        order: -1;
    }
}

.rolling-digit {
    display: inline-block;
    min-width: 18px;
    font-weight: 600;
    font-size: 18px;
    color: #b30000;
}

.table-live.styled tr.pending .rolling-digit {
    color: #999;
}

.giai_bay_blocks .rolling-digit {
    color: #a60000;
}

/* Circular loading spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #b30000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 2px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Style for pending state using loading spinners */
.table-live.styled tr.pending .loading-spinner {
    border-top: 2px solid #999;
}

.giai_bay_blocks .loading-spinner {
    border-top: 2px solid #a60000;
}

.number-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 42px;
    min-height: 26px;
    position: relative;
    width: 100%;
}

.number-slot__value {
    display: inline-block;
    letter-spacing: 1px;
    font-weight: 600;
}

.number-slot--revealed .number-slot__value {
    animation: number-slot-pop 0.45s ease forwards;
}

@keyframes number-slot-pop {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.latest-history {
    margin-top: 16px;
    border: 1px solid #e3d0d1;
    border-radius: 0;
    background: #fffafa;
    overflow-x: auto;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.latest-history__table {
    width: 100%;
    border-collapse: collapse;
    min-width: 480px;
}

.latest-history__table thead th {
    background: linear-gradient(180deg, #ffe2e2, #ffcaca);
    color: #7f0303;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 16px;
    text-align: left;
}

.latest-history__table tbody td {
    padding: 12px 16px;
    border-top: 1px solid #f3dede;
    font-size: 15px;
    letter-spacing: 0.4px;
}

.latest-history__table tbody tr:nth-child(even) {
    background: #fff3f3;
}

.latest-history__table tbody tr:hover {
    background: #ffecec;
}

.latest-history__table tbody td:first-child {
    font-weight: 600;
    color: #611010;
}

.latest-history__table tbody td:nth-child(2),
.latest-history__table tbody td:nth-child(3) {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
}

@media (max-width: 768px) {
    .latest-history__table {
        min-width: 100%;
    }
}

/* Widget Styles for MONO - Tech/Blockchain Theme */
.crypto-widget, .blockchain-widget, .nft-widget, .api-widget {
    background: #f8f9fa;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #6c757d;
    font-family: 'Courier New', monospace;
}

.wallet-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.wallet-btn {
    padding: 8px 12px;
    border: 1px solid #495057;
    background: #e9ecef;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.wallet-btn:hover {
    background: #495057;
    color: white;
}

.wallet-status {
    font-size: 12px;
    color: #6c757d;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    margin-right: 5px;
}

.block-info {
    font-size: 12px;
}

.block-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px dotted #6c757d;
}

.block-item code {
    background: #e9ecef;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 10px;
}

.nft-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.nft-card {
    text-align: center;
    border: 1px solid #6c757d;
    border-radius: 4px;
    padding: 8px;
}

.nft-image {
    background: linear-gradient(45deg, #6c757d, #495057);
    color: white;
    padding: 15px 5px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 5px;
}

.nft-card span {
    font-size: 10px;
    color: #6c757d;
}

.api-status {
    font-size: 12px;
}

.api-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.api-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 8px;
}

.api-dot.green {
    background: #28a745;
    box-shadow: 0 0 4px #28a745;
}

.latency {
    font-family: 'Courier New', monospace;
    color: #28a745;
    font-weight: bold;
}
