/**
 * CPC 队伍卡片 — 与 rank 扁平风格一致；国旗槽位固定尺寸（与榜单 .flag-icon 比例接近）。
 */

.cpc-team-display-page .cpc-team-cards-grid,
.cpc-rank-unified-root .cpc-team-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 12px;
    align-content: start;
}

.cpc-team-card {
    /* 教练/选手：首列 = 校徽 56px + 顶栏 gap 8px（与 __header 一致） */
    --cpc-card-logo-slot: 56px;
    --cpc-card-header-gap: 8px;
    --cpc-card-coach-label-col: calc(var(--cpc-card-logo-slot) + var(--cpc-card-header-gap));
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* 顶栏：校徽 | 文案区 | 账号+场地（固定右栏）；国旗在校名行左侧 */
.cpc-team-card__header {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.cpc-team-card__school-flag-slot {
    flex: 0 0 24px;
    width: 24px;
    min-height: 18px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.cpc-team-card__school-flag-slot .flag-icon {
    width: 24px;
    height: 18px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
    display: block;
}

/* 无可用国旗图（JS 解析失败或 onerror）：不占 flex 宽度 */
.cpc-team-card__school-flag-slot.cpc-team-card__school-flag-slot--empty {
    flex: 0 0 0;
    width: 0;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    border: 0;
}

.cpc-team-card__logo.school-logo {
    /* rank.css 全局 .school-logo 为榜单行水印（absolute + 低 opacity）；此处必须覆盖，否则 CPC rank「尚无提交」页与 rank.css 同载时校徽会叠到 main 左上角 */
    position: relative;
    inset: auto;
    opacity: 1;
    z-index: auto;
    pointer-events: auto;
    /*
     * rank.css 对 .school-logo 使用 crisp-edges/pixelated，适合行背景水印；
     * 本处为清晰展示位图校徽，与滚榜行内 .rank-row-roll .school-logo 一致用 auto。
     * （team_display 单页不加载 rank.css，本声明对两路径无害。）
     */
    image-rendering: auto;
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    box-sizing: border-box;
    background-color: #ffffff;
    background-image: url('/static/image/logos/ccpc.webp');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cpc-team-card__logo.school-logo.has-background {
    background-image: var(--rank-school-logo-bg);
    background-size: var(--cpc-card-badge-bg-size, contain);
    background-position: center;
    background-repeat: no-repeat;
}

.cpc-team-card__header-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.cpc-team-card__title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 8px;
    width: 100%;
    min-width: 0;
}

/* 队名区：左上角标（打星小黄星 / 女队粉心）与全站 csg_ui_markers 同源，不占文档流 */
.cpc-team-card__name-wrap {
    position: relative;
    display: block;
    flex: 1 1 auto;
    min-width: 0;
}

.cpc-team-card__name {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
    min-width: 0;
}

/* 队名 / 英文名 / 校名：间歇横向跑马（csg_marquee_plain · buildIntermittentTrack） */
.cpc-team-card__mq {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: clip;
    position: relative;
    min-width: 0;
}

.cpc-team-card__mq .csg-mq-inter-clip {
    display: block;
    overflow: hidden;
    width: 100%;
}

.cpc-team-card__mq .csg-mq-inter-track {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    white-space: nowrap;
    vertical-align: top;
    will-change: transform;
}

.cpc-team-card__mq .csg-mq-inter-sep {
    flex: 0 0 auto;
    font-weight: 600;
}

.cpc-team-card__mq[data-csg-mq-inter='1'] {
    white-space: nowrap;
}

.cpc-team-card__name-en {
    font-size: 13px;
    color: #475569;
    line-height: 1.35;
    width: 100%;
}

.cpc-team-card__school-line {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.cpc-team-card__school {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    line-height: 1.35;
}

.cpc-team-card__header-end {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 5.75rem;
    max-width: 40%;
}

.cpc-team-card__tid {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.02em;
    text-align: right;
    word-break: break-all;
    max-width: 100%;
}

.cpc-team-card__room-slot {
    min-height: 1.35em;
    min-width: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
}

.cpc-team-card__pill {
    display: inline-block;
    max-width: 100%;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 4px;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

.cpc-team-card__groups {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    min-width: 0;
}

.cpc-team-card__group-chip {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
    max-width: 100%;
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.35;
    color: #334155;
    background: #f1f5f9;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 4px;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.cpc-team-card__body {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* 左 label（与校徽左缘对齐）| 右值（与队名左缘对齐） */
.cpc-team-card__row {
    display: grid;
    grid-template-columns: var(--cpc-card-coach-label-col) minmax(0, 1fr);
    column-gap: 0;
    row-gap: 4px;
    align-items: center;
    width: 100%;
    font-size: 13px;
    line-height: 1.35;
    min-width: 0;
}

.cpc-team-card__row .cpc-team-card__lbl {
    justify-self: start;
    min-width: 0;
    max-width: 100%;
}

.cpc-team-card__row .cpc-team-card__val {
    min-width: 0;
}

/*
 * 教练 / 选手值：`applyCpcCoachMemberSlot`（≤2 行静态；>2 行且单行宽于槽 → 间歇跑马）。
 */
.cpc-team-card .cpc-team-card__hud-mq-slot {
    display: block;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    min-height: calc(2 * 1.35em);
    max-height: calc(2 * 1.35em);
}

.cpc-team-card .cpc-team-card__hud-mq-slot.cpc-hud-mq-pending {
    visibility: hidden;
}

.cpc-team-card .cpc-team-card__hud-mq-slot[data-cpc-mq-ready='1']:not([data-csg-mq-inter='1']) {
    max-height: none;
}

.cpc-team-card .cpc-team-card__hud-mq-slot.contestlive-hud-headline-slot--single[data-cpc-mq-ready='1'] {
    min-height: 1.35em;
    max-height: 1.35em;
}

.cpc-team-card .cpc-team-card__hud-mq-slot.csg-mq-slot--twoline {
    overflow: hidden;
}

.cpc-team-card .cpc-team-card__hud-mq-slot.csg-mq-slot--twoline .csg-mq-slot__inner {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.cpc-team-card .cpc-team-card__hud-mq-slot.contestlive-hud-headline-slot--single {
    display: flex;
    align-items: center;
    max-height: 1.35lh;
    -webkit-line-clamp: unset;
}

.cpc-team-card .cpc-team-card__hud-mq-slot.contestlive-hud-headline-slot--single .csg-mq-slot__inner {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: clip;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
}

.cpc-team-card .cpc-team-card__hud-mq-slot .csg-mq-inter-clip {
    display: block;
    overflow: hidden;
    width: 100%;
}

.cpc-team-card .cpc-team-card__hud-mq-slot .csg-mq-inter-track {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    white-space: nowrap;
    vertical-align: top;
    will-change: transform;
}

.cpc-team-card .cpc-team-card__hud-mq-slot .csg-mq-inter-sep {
    flex: 0 0 auto;
    font-weight: 600;
}

.cpc-team-card .cpc-team-card__hud-mq-slot[data-csg-mq-inter='1'] {
    min-height: 1.35em;
    max-height: 1.35em;
}

.cpc-team-card__lbl {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    line-height: 1.12;
    color: #64748b;
    font-weight: 500;
}

.cpc-team-card__lbl .cn-text {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
    line-height: 1.15;
}

.cpc-team-card__lbl .en-text {
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.cpc-team-card__val {
    color: #1e293b;
    min-width: 0;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-variant-numeric: tabular-nums;
}

.cpc-rank-unified-root {
    min-height: 72vh;
}

.cpc-rank-wait-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 0.25rem 1.5rem;
}

.cpc-rank-wait-note {
    max-width: 48rem;
}

.cpc-team-cards-empty {
    margin-bottom: 0.75rem;
}
