:root {
    --header-h: 50px;
    --sidebar-w: 240px;
    --blue: #3b82f6;
    --red: #ef4444;
    --bg-gray: #f8f9fa;
    --border: #e5e7eb;
    --text-dark: #111827; /* darker for readability */
    --text-gray: #4b5563; /* darker gray for readability */
    --table-header-bg: #f3f4f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    font-size: 16px; /* overall larger text */
    background: #fff;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- App Container --- */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* --- Top Nav --- */
.top-nav {
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #2563eb;
    margin-right: 40px;
}

.nav-links {
    display: flex;
    gap: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    flex: 1;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    padding-bottom: 14px;
    border-bottom: 2px solid transparent;
}

.nav-links a.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}

.top-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.language-select {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
}

/* LiveStream list binding badge */
.ls-bind-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.ls-bound {
    color: #1d4ed8;            /* blue text */
    background: #dbeafe;       /* light blue bg */
    border: 1px solid #bfdbfe;
}

.ls-unbound {
    color: #dc2626;            /* red text */
}

.update-info {
    font-size: 14px;
    color: var(--text-gray);
}

/* --- App Body --- */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-w);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: #fff;
}

.sidebar-tabs {
    display: flex;
}

.tab-btn {
    flex: 1;
    border: none;
    background: #f9fafb;
    padding: 10px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-gray);
}

.tab-btn.active {
    background: #fff;
    color: var(--blue);
    border-bottom: none;
}

.sub-tabs {
    padding: 10px 20px;
    display: flex;
    gap: 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.sub-tab {
    cursor: pointer;
    padding: 5px 0;
    color: var(--text-dark);
}

.sub-tab.active {
    color: var(--blue);
    font-weight: 500;
    border-bottom: 2px solid var(--blue);
}

.sport-list {
    overflow-y: auto;
    padding: 10px 0;
}

.sport-item {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.2s;
}

.sport-item:hover {
    background: #f3f4f6;
}

.sport-item.active {
    background: #eff6ff;
    color: var(--blue);
    font-weight: 500;
}

.sport-item .name {
    flex: 1;
}

.sport-item .count {
    color: var(--text-gray);
    font-size: 12px;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    min-width: 0;
}

/* Monitor page: allow scrolling inside app-body (app-body itself is overflow hidden) */
.monitor-main {
    min-height: 0;        /* important for flex children to allow scrolling */
    overflow-y: auto;
    padding-bottom: 80px; /* prevent bottom table from being cut off */
}

/* --- System Status Bar (top of feature page) --- */
.system-status-bar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.system-status-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.system-status-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.system-status-updated {
    font-size: 12px;
}

.system-status-items {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.system-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 180px;
    background: #fff;
}

.system-status-item-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-gray);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.system-status-item-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #9ca3af; /* unknown */
    box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.15);
}

.status-dot.is-healthy {
    background: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

.status-dot.is-unhealthy {
    background: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

.system-status-item.is-healthy {
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(22, 163, 74, 0.04);
}

.system-status-item.is-unhealthy {
    border-color: rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.04);
}

.system-status-detail {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Monitor page widgets (Monitor.cshtml) --- */
.status-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 12px;
}

.metric-icon {
    font-size: 28px;
    line-height: 1;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: #e5e7eb;
    color: #111827;
}

.status-healthy {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    border: 1px solid rgba(22, 163, 74, 0.25);
}

.status-unhealthy {
    background: rgba(220, 38, 38, 0.12);
    color: #991b1b;
    border: 1px solid rgba(220, 38, 38, 0.25);
}

.table-container {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 12px;
}

/* Light red blinking for mismatches */
@keyframes mismatchFlash {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(254, 202, 202, 0.65); } /* light red */
}

.mismatch-row {
    animation: mismatchFlash 1.0s ease-in-out infinite !important;
}

.mismatch-row td {
    animation: mismatchFlash 1.0s ease-in-out infinite !important;
}

.toolbar {
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.search-wrap {
    position: relative;
    width: 250px;
}

.search-wrap input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
}

.toolbar-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.countdown {
    font-size: 14px;
    color: var(--text-gray);
}

.btn-refresh {
    background: var(--blue);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-refresh:hover {
    background: #2563eb;
}

/* --- Floating draggable panel (League logo maintenance) --- */
.floating-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(calc(-50% + var(--drag-x, 0px)), calc(-50% + var(--drag-y, 0px)));
    width: min(520px, calc(100vw - 24px));
    max-height: min(78vh, 720px);
    z-index: 1060; /* above regular content; similar to modal stack */
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    overflow: hidden;
}

.floating-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #111827;
    color: #fff;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.floating-panel-header.is-dragging {
    cursor: grabbing;
}

.floating-panel-title {
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
}

.floating-panel-body {
    padding: 12px;
    overflow: auto;
    max-height: calc(min(78vh, 720px) - 44px);
}

.floating-panel .btn-close {
    filter: invert(1);
    opacity: 0.9;
}

/* --- TABLE --- */
.table-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
}

/* --- sample2.html inspired events list --- */
.s2-container {
    max-width: 1360px;
    min-width: 1160px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.s2-main-header {
    background-color: #7cb342;
    color: #fff;
    height: 44px;
    display: flex;
    align-items: center;
    padding-left: 10px;
}

.s2-header-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.s2-header-options {
    display: flex;
    height: 100%;
}

.s2-header-opt-item {
    font-size: 12px;
    font-weight: 700;
    border-left: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    padding: 0 10px;
}

.s2-collapse-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
}

.s2-collapse-all:hover {
    background: rgba(255,255,255,0.18);
}

.s2-w-result { width: 160px; }
.s2-w-handicap { width: 200px; }
.s2-w-total { width: 160px; }
.s2-w-remark { width: 160px; }

.s2-odds-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}

.s2-odds-table .league-row {
    background-color: #eef1f3;
    border-bottom: 1px solid #dce1e6;
    color: #444;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    height: 36px;
}

.s2-odds-table .league-toggle-row td {
    cursor: pointer; /* hand cursor on hover */
}

.s2-odds-table .league-toggle-row:hover td {
    background-color: #e6edf5;
}

.s2-odds-table .league-toggle-cell {
    text-align: right;
    padding-right: 10px;
}

.s2-odds-table .league-toggle-icon {
    display: inline-block;
    font-size: 14px;
    font-weight: 800;
    color: #607d8b;
    user-select: none;
}

.s2-odds-table .league-hidden {
    display: none;
}

.s2-odds-table .league-name {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer; /* open league logo maintenance panel */
}

.s2-odds-table .sub-header {
    color: #666;
    font-weight: 600;
    text-align: center;
}

.s2-odds-table .match-row {
    background-color: #fff;
    border-bottom: 1px solid #eef1f3;
    height: 50px;
}

.s2-odds-table .match-row:hover {
    background-color: #f7f9fa;
}

.s2-odds-table .col-icon-star,
.s2-odds-table .col-icon-arrow {
    text-align: center;
    color: #b0bec5;
    cursor: pointer;
    user-select: none;
}

.s2-odds-table .col-info {
    text-align: left;
    padding-left: 6px;
    vertical-align: middle;
    overflow: hidden;
}

.s2-odds-table .teams {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.s2-odds-table .meta-info {
    font-size: 12px;
    color: #7f8c8d;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

    .s2-odds-table .meta-schedule {
        color: #111; /* black */
        font-weight: 600;
        padding-left: 20px;
    }

.s2-odds-table .meta-live {
    color: #dc2626; /* red */
    font-weight: 700;
}

/* Sample2 meta pieces */
.s2-odds-table .meta-score {
    color: #1976d2; /* score in blue */
    font-weight: 700;
}

.s2-odds-table .meta-score.flash-change {
    border-radius: 4px;
    padding: 1px 4px;
    margin: -1px -4px;
}

.s2-odds-table .icon-chart {
    font-size: 12px;
    color: #95a5a6;
}

.s2-odds-table .odds-grid-result {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 0 4px;
}

.s2-odds-table .odds-grid-handicap {
    display: grid;
    grid-template-columns: 35px 1fr 35px 1fr;
    gap: 2px;
    align-items: center;
    padding: 0 4px;
}

.s2-odds-table .odds-grid-total {
    display: grid;
    grid-template-columns: 45px 1fr 1fr;
    gap: 2px;
    align-items: center;
    padding: 0 4px;
}

    .s2-odds-table .odd-box {
        background-color: #f4f6f8;
        height: 32px;
        letter-spacing: .3px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        color: #333;
        border-radius: 3px;
        cursor: pointer;
        transition: all 0.1s;
    }

.s2-odds-table .odd-box:hover {
    background-color: #e3e8ed;
    color: #000;
}

.s2-odds-table .odd-box.is-empty {
    color: #9aa4ad;
    cursor: default;
}

.s2-odds-table .blue-val {
    color: #1976d2;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.s2-odds-table .blue-val.flash-change {
    border-radius: 4px;
    padding: 1px 3px;
}

.s2-odds-table .remark-content {
    text-align: center;
    color: #888;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
}

/* TV icon (livestream binding entry point) */
.ls-tv {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    color: #9ca3af; /* gray by default */
    cursor: pointer;
    border-radius: 4px;
}

.ls-tv:hover {
    background: rgba(0,0,0,0.06);
    color: #6b7280;
}

.ls-tv.is-live {
    color: #2563eb; /* colored TV if has stream */
}

.ls-tv.is-live:hover {
    background: rgba(37, 99, 235, 0.10);
}

/* Clickable team name for logo maintenance */
.team-name-maint {
    cursor: pointer;
}

.team-name-maint:hover {
    text-decoration: underline;
}

/* Team logo modal layout */
.team-logo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid #eef1f3;
}

.team-logo-row:last-child {
    border-bottom: none;
}

.team-logo-img img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.team-logo-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #9aa4ad;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.team-logo-name {
    font-weight: 700;
    color: #2c3e50;
}

.team-logo-main {
    flex: 1;
    min-width: 0;
}

.team-logo-controls {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.team-logo-controls input {
    flex: 1;
    min-width: 0;
}

.team-logo-status {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    min-height: 16px;
}

.team-logo-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    min-height: 18px;
}

.team-logo-preview-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    flex: 0 0 auto;
}

.team-logo-preview-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    background: #f3f4f6;
    border: 1px solid #eef1f3;
}

.team-logo-preview-hint {
    font-size: 12px;
    color: #6b7280;
}

.team-logo-log {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #eef1f3;
    max-height: 160px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.35;
    color: #374151;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.team-logo-log-item {
    padding: 4px 0;
    border-bottom: 1px solid #f3f4f6;
}

.team-logo-log-item:last-child {
    border-bottom: none;
}

.team-logo-log-item.ok {
    color: #166534; /* green */
}

.team-logo-log-item.err {
    color: #b91c1c; /* red */
}

.team-logo-log-ts {
    color: #6b7280;
}

.team-logo-log-stage {
    font-weight: 700;
    margin: 0 6px;
    text-transform: uppercase;
}
/* sample3.html-inspired modal/table */
.s3-modal {
    border: none;
    border-radius: 6px;
    overflow: hidden;
}

.s3-modal-header {
    background-color: #7cb342;
    color: #fff;
    border-bottom: none;
}

.s3-container {
    background: #fff;
}

.s3-odds-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.s3-odds-table .league-row {
    background-color: #eef1f3;
    border-bottom: 1px solid #dce1e6;
    color: #444;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    height: 32px;
}

.s3-odds-table .league-name {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 10px;
}

.s3-odds-table .league-name.ls-modal-context {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.ls-modal-line1 {
    font-size: 11px;
    font-weight: 800;
    color: #444;
}

.ls-modal-line2 {
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    text-transform: none;
}

.ls-modal-time {
    color: #6b7280;
    font-weight: 600;
}

.s3-odds-table .sub-header {
    color: #666;
    text-align: center;
    font-weight: 600;
}

.s3-odds-table .match-row {
    background-color: #fff;
    border-bottom: 1px solid var(--border);
    height: 52px;
}

.s3-odds-table .match-row:hover {
    background-color: #f9f9f9;
}

/* Bound row highlight (only for current tblGameData.EvtID) */
.s3-odds-table .match-row.is-bound-current {
    background-color: #fdecec;
}
.s3-odds-table .match-row.is-bound-current:hover {
    background-color: #fbe0e0;
}

/* Bound to other event (neutral hint) */
.s3-odds-table .match-row.is-bound-other {
    background-color: #f5f6f7;
}

.s3-odds-table td {
    padding: 4px;
    vertical-align: middle;
}

.s3-odds-table .col-star,
.s3-odds-table .col-arrow {
    text-align: center;
    color: #ccc;
    cursor: pointer;
    padding: 0 !important;
    user-select: none;
}

.s3-odds-table .col-info {
    text-align: left;
    padding-left: 6px !important;
    overflow: hidden;
}

.s3-odds-table .team-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.s3-odds-table .teams {
    font-weight: 700;
    color: #222;
    margin-bottom: 4px;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.s3-odds-table .match-time {
    font-size: 11px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.s3-odds-table .btn-bind {
    background-color: #1976d2;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 6px 0;
    font-size: 12px;
    cursor: pointer;
    width: 80px;
    display: block;
    margin: 0 auto;
    transition: background 0.1s;
}

.s3-odds-table .btn-bind:hover {
    background-color: #1565c0;
}

/* Unbind button (purple) */
.s3-odds-table .btn-unbind {
    background-color: #7e57c2;
}

.s3-odds-table .btn-unbind:hover {
    background-color: #6a42b6;
}

/* Subtle loading indicator without clearing the table (improves perceived speed) */
.table-wrapper.is-loading {
    position: relative;
}

/* (replaced by unified spinner overlay below) */

/* Spinner overlay (events / categories / championships) */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.is-loading {
    position: relative;
}

.is-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    z-index: 10;
}

.is-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(17, 24, 39, 0.25);
    border-top-color: rgba(17, 24, 39, 0.85);
    border-radius: 999px;
    animation: spin 0.8s linear infinite;
    top: 12px;
    right: 12px;
    z-index: 11;
    pointer-events: none;
}

/* Fine-tune placements for different containers */
#sportCategories.is-loading::after {
    top: 10px;
    right: 10px;
}

#championshipView.is-loading::after {
    top: 14px;
    right: 18px;
}

.odds-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    table-layout: fixed;
    font-size: 13px;
    border: 1px solid var(--border);
}

/* Column widths - 使用 !important 确保生效 */
.col-evtid {
    width: 6% !important;
}

.col-match {
    width: 30% !important;  /* 队伍列宽度： 40% ->30% */
}

.col-bookie {
    width: 5% !important;
}

.col-group {
    width: 18% !important;  /* 赔率组宽度：13.67% → 15.33% (多出的5%平均分配给3个赔率组) */
    background: #f1f5f9;
    text-align: center;
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Column headers row (replaces thead) */
.column-headers td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: #fff;
    color: var(--text-gray);
    font-weight: 500;
    font-size: 12px;
    border-top: 1px solid var(--border);
}

/* Group headers special styling */
.column-headers .col-group {
    background: #f8fafc;
    text-align: center;
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* League header row - 合并联盟名称和栏位标题 */
.league-row td {
    background: #edf2f7;
    padding: 8px 10px;
    font-weight: 600;
    color: #475569;
    border-top: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    font-size: 13px;
    text-align: left;
}

/* 联盟名称第一部分（图标） */
.league-row .league-name-part1 {
    font-weight: 700;
    font-size: 13px;
    border-right: none;  /* 移除右边框，看起来像合并 */
    padding-right: 0;
    text-align: right; /* league icon靠右 */
}

/* 联盟名称第二部分（文字） */
.league-row .league-name-part2 {
    font-weight: 700;
    font-size: 13px;
    border-left: none;   /* 移除左边框，看起来像合并 */
    padding-left: 0;
}

/* 联盟行的栏位标题样式 */
.league-row .col-group {
    background: #f8fafc;
    text-align: center;
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* League icon */
.league-icon {
    margin-right: 8px;
    font-size: 14px;
    vertical-align: middle;
    display: inline-block;
}

/* Small icons (league/team) */
.mini-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    vertical-align: -2px;
}

.league-mini-icon {
    margin-right: 0; /* 靠右不需要右邊距 */
}

.team-mini-icon {
    margin-right: 6px;
}

.team-with-icon {
    display: inline-flex;
    align-items: center;
    min-width: 0; /* allow ellipsis inside */
}

.team-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vs-text {
    margin: 0 4px;
    color: var(--text-gray);
}

.odds-cell.winner-hidden {
    cursor: default;
}

.odds-cell.winner-hidden:hover {
    background-color: transparent;
}

/* League row text alignment */
.league-row td strong {
    vertical-align: middle;
    display: inline-block;
    line-height: 14px;
}

/* --- Championship (sample.html-like) --- */
.championship-view {
    padding: 15px;
    overflow-y: auto;
}

.champ-block {
    max-width: 900px;            /* 避免滿版拉太寬，WINNER 位置更貼近左側 */
    margin: 0 auto 12px auto;    /* 置中 */
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
}

    .champ-block .race-header {
        background-color: #5e6a78;
        padding: 10px 12px;
        font-weight: 600;
        font-size: 13px;
        color: #FFFFFF;
        border-bottom: 1px solid #e0d5d5;
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
    }

.champ-league-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.champ-league-icon-placeholder {
    width: 14px;
    height: 14px;
    display: inline-block;
}

.champ-block .race-time {
    margin-left: auto;
    color: #FFFFFF;
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.champ-chevron {
    margin-left: 6px;
    color: #777;
}

.champ-block.collapsed .champ-content {
    display: none;
}

.champ-content {
    display: flex;
}

/* 左側放資料 */
.champ-left {
    flex: 0 0 60%;
    min-width: 360px; /* 避免太窄 */
}

.champ-remark {
    flex: 0 0 40%;
}

.champ-block .col-odds-group {
    width: 140px;
}

.champ-block .odds-column {
    width: 140px;
}

@media (max-width: 900px) {
    /* 小螢幕不要硬留 60% 空白，避免內容擠壓 */
    .champ-left {
        flex: 1 1 auto;
        min-width: 0;
    }
    .champ-remark {
        display: none;
    }
}

.champ-block .col-remark {
    flex: 1;
    padding-left: 12px;
    display: flex;
    align-items: center;
}

.champ-block .col-remark-title {
    margin-bottom: 4px;
    color: #999;
}

.champ-block .remark-row {
    padding-left: 12px;
}

.champ-block .remark-cell {
    color: var(--text-dark);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.champ-block .market-header-row {
    display: flex;
    background-color: #f7f7f7;
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-gray);
}

.champ-block .col-driver {
    flex: 1;
    padding-left: 12px;
    display: flex;
    align-items: center;
}

.champ-block .col-odds-group {
    width: 160px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.champ-block .col-odds-group-title {
    margin-bottom: 4px;
    color: #999;
}

.champ-block .col-odds-sub {
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
}

.champ-block .col-odds-sub span {
    flex: 1;
    text-align: center;
}

.champ-block .driver-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

.champ-block .driver-row:hover {
    background-color: #fafafa;
}

.champ-block .driver-info {
    flex: 1;
    display: flex;
    align-items: center;
    padding-left: 8px;
    min-width: 0;
}

.champ-block .star-icon {
    color: #d1d5db;
    margin-right: 10px;
    cursor: pointer;
    width: 16px;
    text-align: center;
}

.champ-block .driver-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ddd;
    margin-right: 10px;
    background-size: cover;
    background-position: center;
    background-image: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    flex: 0 0 auto;
}

.champ-block .driver-name {
    font-weight: 600;
    font-size: 12px;
    color: #333;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.champ-block .odds-section {
    display: flex;
}

.champ-block .odds-column {
    width: 160px;
    display: flex;
    gap: 6px;
    padding: 0 8px;
}

.champ-block .odd-btn {
    flex: 1;
    background-color: #f8f9fa;
    border-radius: 3px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
}

.champ-block .odd-btn:hover {
    background-color: #e9ecef;
}

/* Match row */
.match-row td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.match-row.closed-row {
    background: #f9fafb;
    opacity: 0.7;
}

.event-id-cell {
    padding: 8px;
    text-align: center;
    font-weight: 500;
    color: var(--text-gray);
    font-size: 11px;
    vertical-align: middle;
}

.match-info-cell {
    /* 移除 flex，使用 block 布局以遵守表格列宽 */
    padding: 4px 8px;
}

.match-status {
    font-size: 12px;
    margin-bottom: 2px;
}

/* 赛事时间 - 灰色 */
.match-status .schedule-time {
    color: var(--text-gray);
    font-weight: 400;
    margin-right: 5px;
}

/* 比赛状态 - 红色 */
.match-status .live-status {
    color: var(--red);
    font-weight: 700;
    margin-right: 5px;
}

/* 比分 - 黑色 */
.match-status .score {
    color: var(--blue); /* 比分改藍色 */
    font-weight: 700;
}

.match-time {
    color: var(--text-gray);
    font-size: 12px;
}

.time-score-wrapper {
    white-space: nowrap;      /* 防止时间和比分换行 */
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.teams {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;      /* 防止文字换行 */
    overflow: hidden;         /* 隐藏溢出内容 */
    text-overflow: ellipsis;  /* 显示省略号 */
}

.live-icon {
    display: inline;
    color: var(--red);
    font-size: 14px;
    margin-left: 6px;
}

.live-icon i {
    vertical-align: text-bottom;
}

.bookie-name {
    color: var(--text-dark);
    font-weight: 500;
    font-size: 13px;
    text-align: left;
}

/* Odds cells */
.odds-cell {
    text-align: right;
    padding: 8px 15px 8px 8px !important;
    position: relative;
    cursor: pointer;
}

.odds-cell:hover {
    background-color: #eff6ff;
}

/* 盘口单元格居中显示 */
.odds-cell.line-cell {
    text-align: center !important;
    padding: 8px !important;
}

/* 有 tooltip 的盘口单元格 */
.odds-cell.has-tooltip {
    cursor: help;
}

/* Odds Tooltip */
.odds-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 5px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 180px;
    z-index: 1000;
    font-size: 12px;
}

.odds-cell.has-tooltip:hover .odds-tooltip {
    display: block;
}

.tooltip-header {
    font-weight: 700;
    color: #1f2937;
    padding: 4px 8px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 6px;
    text-align: center;
    font-size: 13px;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    border-radius: 3px;
}

.tooltip-row:hover {
    background: #f3f4f6;
}

.tooltip-odds {
    color: var(--blue);
    font-weight: 500;
    min-width: 50px;
    text-align: center;
}

.tooltip-line {
    font-weight: 700;
    color: #1f2937;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 3px;
    min-width: 50px;
    text-align: center;
}

/* 特定赔率单元格左对齐 (TOTAL Under, HANDICAP Away) */
.odds-cell.left-align {
    text-align: left !important;
    padding: 8px 8px 8px 15px !important;
}

.odds-value {
    display: inline-block;
    color: var(--blue);
    font-weight: 500;
    font-size: 14px;
}

/* 红色赔率 */
.text-red {
    color: var(--red) !important;
}

.line-value {
    display: inline-block;
    font-weight: 700;
    color: #333;
    font-size: 14px;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-gray);
}

.text-danger {
    color: var(--red);
}

.py-5 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

/* Responsive adjustments */
/* Phones only (avoid affecting iPad 768px) */
@media (max-width: 600px) {
    .sidebar {
        width: 200px;
    }
    
    .col-match {
        width: 50%;  /* 移动端队伍列更宽：40% → 50% */
    }
    
    .col-bookie {
        width: 8%;
    }
    
    .col-group {
        width: 4%;   /* 移动端赔率组更窄 */
    }
}

/* iPad/tablet: make left menu wider to reduce wrapping */
@media (min-width: 768px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
}

/* Draggable Bootstrap modal (LiveStream binding) */
#livestreamModal .modal-dialog.modal-draggable {
    position: fixed;
    left: 50%;
    top: 50%;
    margin: 0;
    transform: translate(calc(-50% + var(--drag-x, 0px)), calc(-50% + var(--drag-y, 0px)));
}

#livestreamModal .modal-draggable-handle {
    cursor: grab;
    user-select: none;
    touch-action: none;
}

#livestreamModal .modal-draggable-handle.is-dragging {
    cursor: grabbing;
}

/* Odds change animations */
.odds-up {
    color: #dc2626 !important;
    font-weight: 700 !important;
    animation: flash-up 0.5s ease-in-out 5;
}

.odds-up::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 3px;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-bottom: 4px solid #dc2626;
    vertical-align: middle;
}

.odds-down {
    color: #16a34a !important;
    font-weight: 700 !important;
    animation: flash-down 0.5s ease-in-out 5;
}

.odds-down::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 3px;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 4px solid #16a34a;
    vertical-align: middle;
}

/* 赔率上升闪烁效果 - 红色 */
@keyframes flash-up {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(220, 38, 38, 0.15); }
}

/* 赔率下降闪烁效果 - 绿色 */
@keyframes flash-down {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(22, 163, 74, 0.15); }
}

/* Flash effect for line and score changes */
@keyframes flash-red {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(254, 202, 202, 0.6); }
}

.flash-change {
    animation: flash-red 0.5s ease-in-out 10;
    animation-duration: 5s;
}

.line-value.flash-change {
    border-radius: 4px;
}

.time-score-wrapper.flash-change {
    background-color: rgba(254, 202, 202, 0.6);
    border-radius: 4px;
    padding: 2px 6px;
    margin: -2px -6px;
}
