body { background-color: #f8fafc; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.max-w-7xl { max-width: 1280px; margin: 0 auto; }

/* ── 紧凑 Header ── */
.site-header { padding: 0.5rem 0; }
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1.3;
}
.header-lookup-btn { white-space: nowrap; flex-shrink: 0; }
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}
.control-group-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.control-group-inline label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #4b5563;
    white-space: nowrap;
}
.control-group-inline select {
    min-width: 160px;
}
.header-update-time {
    margin-left: auto;
}

/* ── Tab 栏（Sticky） ── */
.tab-bar-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: #fff;
    padding: 0.5rem 0;
    border-bottom: 2px solid #e5e7eb;
    flex-wrap: wrap;
}
.tracker-tabs {
    display: flex;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tracker-tabs .nav-item { flex-shrink: 0; }
.tracker-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 0.5rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #6b7280;
    background: transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.tracker-tabs .nav-link:hover {
    color: #1f2937;
    border-bottom-color: #d1d5db;
}
.tracker-tabs .nav-link.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: transparent;
}
.tracker-tabs .nav-link .badge {
    font-size: 0.7rem;
    vertical-align: middle;
}

/* 搜索框 */
.search-box-wrapper {
    flex-shrink: 0;
    max-width: 280px;
    width: 100%;
}
.search-box-wrapper .form-control {
    border-radius: 20px;
    padding-left: 1rem;
    font-size: 0.875rem;
}

/* ── 统一 Card 样式 ── */
.tracker-card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
}
.card { border-radius: 12px; border: none; box-shadow: 0 4px 6px rgba(0,0,0,0.05); overflow: hidden; }

/* 统一 Card Header：深灰底 + 白字 + 左侧彩色竖条 */
.tracker-card-header {
    background: #374151;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid transparent;
}
.header-accent-amber { border-left-color: #f59e0b; }
.header-accent-green { border-left-color: #10b981; }
.header-accent-blue  { border-left-color: #3b82f6; }

/* ── 表格通用 ── */
.badge-method { font-size: 0.85em; padding: 0.5em 0.7em; white-space: normal; text-align: left; }
.badge.bg-secondary.badge-method,
.badge-method.bg-secondary {
    background-color: #5a6268 !important;
    color: #fff !important;
}
.table-caption { font-weight: 600; margin-bottom: 0.25rem; }

/* 表头固定 */
.sticky-header th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa !important;
    z-index: 10;
    box-shadow: inset 0 -2px 0 #dee2e6;
}

/* Skills 行颜色 */
.skills-row-qualified { background-color: #d1d5db !important; color: #1f2937; }
.skills-row-rollable { background-color: #fde68a !important; font-weight: 600; border-left: 5px solid #b45309 !important; color: #212529; }
.skills-row-rollable .text-secondary { color: #495057 !important; }
.skills-row-rollable .text-muted { color: #495057 !important; }
.skills-row-beyond { background-color: #e2e8f0 !important; font-weight: normal; color: #1f2937; }
.score-font { font-family: "Courier New", Courier, monospace; font-weight: bold; color: #d97706;}
.skills-row-rollable .score-font { color: #92400e !important; }
.roll-down-badge { background-color: #b45309 !important; color: #fff !important; font-weight: 700; font-size: 0.8em; }

/* Skills 分页 */
.pagination { text-align: center; margin-top: 1rem; }
.page-link { cursor: pointer; padding: 0.5rem 0.75rem; margin: 0 0.25rem; display: inline-block; border-radius: 4px; text-decoration: none; color: inherit; border: 1px solid #dee2e6; background: #fff; }
.page-link:hover:not(.disabled):not(.active) { background: #e9ecef; }
.page-link.active { background: #007bff; color: white; border-color: #007bff; }
.page-link.disabled { cursor: not-allowed; opacity: 0.6; }

/* Skills 表行交互 */
#skills-tbody tr { transition: background-color 0.2s ease; }
#skills-tbody tr:hover { background-color: #f0f0f0; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
#skills-tbody tr:focus-visible { outline: 2px solid #007bff; outline-offset: -1px; }

/* Signature/Regional 表 hover */
#sig-tbody tr:hover,
#reg-tbody tr:hover { background-color: #f8f9fa; }

/* Team / Event 链接 */
.team-link { color: inherit; text-decoration: none; font-weight: bold; }
.team-link:hover { text-decoration: underline; color: #0d6efd; }
.event-link { color: inherit; text-decoration: none; }
.event-link:hover { text-decoration: underline; color: #0d6efd; }

/* Qualification Method 单元格 */
.qual-method-cell { min-width: 180px; max-width: 360px; }

/* 多奖项队伍 — 被释放的奖项信息 */
.freed-award-line {
    display: block; font-size: 0.8rem; color: #6b7280; margin-top: 0.3rem;
    padding: 0.2rem 0.4rem; background: #fef3c7;
    border-left: 3px solid #f59e0b; border-radius: 0 4px 4px 0; line-height: 1.4;
}
.freed-award-icon { font-weight: 700; color: #d97706; }
.freed-award-name { font-weight: 600; color: #92400e; }
.freed-award-arrow { color: #9ca3af; margin: 0 0.15rem; }
.freed-to-team { font-weight: 700; color: #059669; font-family: "Courier New", monospace; }

/* Roll-down 来源信息 */
.rolldown-source { display: block; font-size: 0.8rem; color: #6b7280; margin-top: 0.25rem; line-height: 1.3; }
.rolldown-source-arrow { color: #10b981; font-weight: 700; margin-right: 0.2rem; }
.rolldown-source-team { font-weight: 700; color: #1f2937; font-family: "Courier New", monospace; }

/* 赛事分组 */
.event-group-first { border-top: 2.5px solid #cbd5e1 !important; }
.event-group-first:first-child { border-top: none !important; }
.event-group-even td { background-color: rgba(241, 245, 249, 0.5); }
.event-group-odd td { background-color: transparent; }

/* 同赛事/跨赛事顺延 */
.rolldown-same-event { color: #9ca3af; }
.rolldown-same-event .rolldown-source-arrow { color: #9ca3af; }
.rolldown-cross-event .rolldown-source-arrow { color: #10b981; }

/* 官方名额对比表 */
.spots-summary { padding: 0.5rem 0.75rem; background: #f8fbff; border-bottom: 1px solid #dee2e6; font-size: 0.95rem; }
.spots-summary table { width: 100%; border-collapse: collapse; margin: 0; }
.spots-summary th { font-size: 0.85rem; text-transform: uppercase; color: #495057; padding: 0.35rem 0.5rem; border-bottom: 2px solid #dee2e6; text-align: center; }
.spots-summary th:first-child { text-align: left; }
.spots-summary td { padding: 0.3rem 0.5rem; text-align: center; border-bottom: 1px solid #eee; }
.spots-summary td:first-child { text-align: left; font-weight: 600; }
.spots-summary tr.spots-total td { font-weight: 700; border-top: 2px solid #adb5bd; border-bottom: none; }
.spots-ok { color: #198754; }
.spots-full { color: #b45309; font-weight: 600; }
.spots-over { color: #dc3545; font-weight: 700; }
.spots-none { color: #6c757d; }
.spots-summary .spots-label { font-weight: 600; color: #0d6efd; margin-bottom: 0.25rem; }

/* ── 移动端响应式 ── */

/* Signature/Regional 表卡片化（≤768px） */
@media (max-width: 768px) {
    .table-standard { display: block; }
    .table-standard thead { display: none; }
    .table-standard tbody, .table-standard tr { display: block; }
    .table-standard tr {
        margin-bottom: 0.5rem; border: 1px solid #dee2e6;
        border-radius: 0.5rem; padding: 1.25rem;
    }
    .table-standard td {
        display: flex; justify-content: space-between; align-items: center;
        padding: 0.75rem 0.5rem !important; min-height: 44px;
    }
    .table-standard td::before {
        content: attr(data-label); font-weight: bold; width: 40%;
    }
    .table-standard td[data-label="Event Name"] {
        max-width: none; white-space: normal; overflow: visible;
        text-overflow: unset; overflow-wrap: break-word; align-items: flex-start;
    }

    /* Skills 表移动端卡片化 */
    .table-skills-responsive table { display: block; }
    .table-skills-responsive thead { display: none; }
    .table-skills-responsive tbody,
    .table-skills-responsive tr { display: block; }
    .table-skills-responsive tr {
        margin-bottom: 0.5rem; border: 1px solid #dee2e6;
        border-radius: 0.5rem; padding: 1rem;
    }
    .table-skills-responsive td,
    .table-skills-responsive th[scope="row"] {
        display: flex; justify-content: space-between; align-items: center;
        padding: 0.6rem 0.5rem !important; min-height: 44px;
        border: none;
    }
    .table-skills-responsive td::before,
    .table-skills-responsive th[scope="row"]::before {
        content: attr(data-label); font-weight: bold; width: 40%;
        font-size: 0.85em; color: #6b7280; flex-shrink: 0;
    }

    /* 分页按钮触摸区域 >= 44px */
    .pagination .page-link {
        min-height: 44px; min-width: 44px;
        display: inline-flex; align-items: center; justify-content: center;
        padding: 0.5rem 0.75rem;
    }

    /* 移动端卡片化时不显示赛事分隔线 */
    .event-group-first { border-top: none !important; }
    .freed-award-line { font-size: 0.75rem; }
    .rolldown-source { font-size: 0.75rem; }

    /* Tab 栏移动端：搜索框全宽 */
    .tab-bar-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .search-box-wrapper {
        max-width: 100%;
    }
    .tracker-tabs {
        overflow-x: auto;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .tracker-tabs::-webkit-scrollbar { display: none; }
}

/* 超小屏幕 */
@media (max-width: 576px) {
    .site-title { font-size: 1.1rem; }
    .tracker-tabs .nav-link { font-size: 0.85rem; padding: 0.4rem 0.75rem; }
    .header-controls { gap: 0.5rem; }
    .control-group-inline select { min-width: 120px; font-size: 0.8rem; }
}

/* ── Event Lookup 页面样式 ── */
.event-info-card .card-body { background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%); }
.event-info-card .badge { font-size: 0.85em; }

/* 搜索区域的卡片不裁切溢出 */
.card:has(.suggestions-dropdown) { overflow: visible; }

/* 赛事搜索联想下拉 */
.suggestions-dropdown {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 1050;
    max-height: 320px; overflow-y: auto; background: #fff;
    border: 1px solid #dee2e6; border-top: none; border-radius: 0 0 8px 8px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}
.suggestions-dropdown.show { display: block; }
.suggestion-item {
    padding: 0.6rem 0.75rem; cursor: pointer;
    border-bottom: 1px solid #f1f5f9; transition: background-color 0.1s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item.active { background-color: #e0f2fe; }
.suggestion-item .sg-name { font-weight: 600; font-size: 0.9rem; color: #1f2937; }
.suggestion-item .sg-meta { font-size: 0.78rem; color: #6b7280; margin-top: 0.1rem; }
.suggestion-item .sg-match { background-color: #fef08a; border-radius: 2px; padding: 0 1px; }
.suggestions-loading { padding: 0.75rem; text-align: center; color: #9ca3af; font-size: 0.85rem; }

/* 已晋级队伍行高亮 */
.event-lookup-qualified { background-color: #d1fae5 !important; }
.event-lookup-qualified:hover { background-color: #a7f3d0 !important; }

/* Event Lookup 表格响应式 */
@media (max-width: 768px) {
    #teams-table-container .table thead { display: none; }
    #teams-table-container .table tbody,
    #teams-table-container .table tr { display: block; }
    #teams-table-container .table tr {
        margin-bottom: 0.5rem; border: 1px solid #dee2e6;
        border-radius: 0.5rem; padding: 0.75rem;
    }
    #teams-table-container .table td {
        display: flex; justify-content: space-between; align-items: center;
        padding: 0.4rem 0.25rem !important; border: none;
    }
    #teams-table-container .table td::before {
        content: attr(data-label); font-weight: bold; width: 40%;
        font-size: 0.85em; color: #6b7280;
    }
}
