/* === STANDARD LAYOUT (Clean Cards + Info Bar) - MODIFIED === */
.std-wrapper {
    display: none;
    flex-direction: column;
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1600px;
    gap: 10px;
}

/* 只有 individual 模式才显示标准布局 */
body[data-mode="individual"] .std-wrapper {
    display: flex;
}

/* tip overlay styles are in tips-overlay.css */

/* === INFO BAR - 主端转播风 === */
.std-info-bar {
    --info-bar-title-size: 24px;
    --info-bar-meta-size: 23px;
    width: 100%;
    height: 64px;
    background: linear-gradient(180deg, rgba(20, 23, 27, 0.96) 0%, rgba(14, 16, 19, 0.98) 100%);
    border: 1px solid rgba(255, 244, 221, 0.12);
    border-bottom: 4px solid #b98a45;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-sizing: border-box;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.std-info-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(232, 210, 170, 0.28) 50%, rgba(255, 255, 255, 0) 100%);
}

.std-info-bar::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 300px;
    height: 100%;
    background: linear-gradient(90deg, rgba(185, 138, 69, 0) 0%, rgba(185, 138, 69, 0.05) 100%);
    pointer-events: none;
}

.info-left {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
}

.info-center {
    position: absolute;
    left: calc(50% + 170px);
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 14px;
    min-width: 280px;
    color: #f3f5f7;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
    pointer-events: none;
}

.info-title {
    font-weight: 700;
    font-size: var(--info-bar-title-size);
    letter-spacing: 1.2px;
    color: #d8d2c7;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
    text-transform: uppercase;
}

.info-round {
    background: linear-gradient(180deg, #cfb07a 0%, #bc9559 58%, #a9783b 100%);
    color: #141414;
    font-weight: 800;
    padding: 5px 16px;
    font-size: var(--info-bar-meta-size);
    line-height: 1;
    border-radius: 3px;
    border: 1px solid rgba(255, 244, 221, 0.26);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 4px rgba(0, 0, 0, 0.24);
}

.info-center-label {
    color: #c5ab76;
    font-size: var(--info-bar-meta-size);
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    position: relative;
    padding-right: 16px;
    letter-spacing: 0.04em;
}

.info-center-label::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 1px;
    height: 18px;
    transform: translateY(-50%);
    background: linear-gradient(180deg, rgba(255, 240, 214, 0) 0%, rgba(255, 240, 214, 0.42) 50%, rgba(255, 240, 214, 0) 100%);
}

.info-center-value {
    color: #f3f5f7;
    font-size: var(--info-bar-meta-size);
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: lining-nums tabular-nums;
    letter-spacing: 0.04em;
    min-width: 8ch;
    text-align: left;
    white-space: nowrap;
}

.info-right {
    position: relative;
    z-index: 1;
    font-size: var(--info-bar-meta-size);
    color: #cfd8e3;
    font-weight: 700;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    align-items: center;
    column-gap: 14px;
    width: 440px;
    flex: 0 0 440px;
    padding-left: 22px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.info-right::before {
    display: none;
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 24px;
    transform: translateY(-50%);
    background: rgba(255, 240, 214, 0.12);
}

.map-tag {
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: end;
    align-self: center;
    color: #8e98a3;
    font-size: var(--info-bar-meta-size);
    font-weight: 800;
    padding: 6px 12px;
    background: linear-gradient(180deg, rgba(185, 138, 69, 0.14) 0%, rgba(185, 138, 69, 0.08) 100%);
    border: 1px solid rgba(255, 240, 214, 0.16);
    border-radius: 999px;
    position: relative;
    white-space: nowrap;
}

.map-tag::before {
    content: '';
    position: absolute;
    left: -13px;
    top: 50%;
    width: 1px;
    height: 20px;
    transform: translateY(-50%);
    background: rgba(255, 240, 214, 0.14);
}

.map-val {
    grid-column: 1;
    grid-row: 1 / span 2;
    color: #f3f5f7;
    font-size: var(--info-bar-meta-size);
    font-weight: 800;
    display: block;
    min-width: 0;
    line-height: 1.08;
    white-space: normal;
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-all;
    align-self: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* === CARD CONTAINER - 缩小30% === */
.std-container {
    width: 100%;
    display: flex;
    gap: 8px;
    /* 原12px -> 缩小33% = 8px */
    height: 118px;
    /* 再增高，避免名字放大后裁切 */
}

/* 卡片基础样式 */
.card {
    flex: 1;
    --rank-strip-width: 34px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f6f8 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: 34px;
    /* 给左侧整高名次色块留空间 */
    box-sizing: border-box;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    overflow: hidden;
    border: none;

    /* 默认可见 */
    opacity: 1;
    transform: translateY(0) translateZ(0);
    /* 强制 GPU 层 */
    will-change: transform;
    /* 告诉浏览器此元素即将变形，提前优化 */

    /* 移除这里的 transition，交由 JS 控制 FLIP 动画 */
    /* transition: transform 0.2s, box-shadow 0.2s; */
}

/* 底部喷漆色条（与组队模式一致） */
.card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--p-color);
    z-index: 0;
}

/* 只对带有 .entrance 类的卡片添加入场动画 */
.card.entrance {
    opacity: 0;
    animation: cardEntry 0.5s ease-out forwards;
    animation-delay: var(--delay, 0s);
}

/* 动效：黑色喷漆修正 (is-dark 类由 JS 计算添加) */
.card.is-dark .card-rank {
    color: #fff !important;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3),
        0 0 15px rgba(255, 255, 255, 0.15),
        0 0 30px rgba(255, 255, 255, 0.08);
}

.card.is-dark {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 255, 255, 0.05);
}

/* === 名字放大，分数变小 === */
.p-main {
    --p-diff-slot-width: 64px;
    width: calc(100% - 0.8ch);
    height: 100%;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    box-sizing: border-box;
    transform: translateX(0.65ch);
    padding: 12px calc(var(--p-diff-slot-width) + 12px) 12px 12px;
}

body[data-show-round-diff-badge="off"][data-mode="individual"] .p-main {
    --p-diff-slot-width: 0px;
    padding-right: 12px;
}

.p-name {
    display: flex;
    align-items: flex-end;
    width: 100%;
    margin-left: 0;
    text-align: left;
    font-family: var(--font-card-ui);
    font-weight: 700;
    font-size: 33px;
    line-height: 1.12;
    letter-spacing: 0em;
    padding: 9px 0 6px;
    margin: 0 0 3px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.64);
    color: #111;
    text-shadow: none;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.p-score {
    font-family: var(--font-card-ui);
    font-size: 46px;
    line-height: 0.95;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: "lnum" 1, "tnum" 1;
    color: #111;
    display: inline-block;
    width: auto;
    margin-left: 0;
    text-align: left;
    margin-top: 3px;

    /* 默认过渡 */
    /* 确保 text-shadow 过渡时间足够长，避免“戛然而止” */
    transition: transform 0.3s ease-out, text-shadow 0.8s ease-out, color 0.3s;
    transform-origin: left center;
}

/* 分数滚动时：持续发光 + 放大 */
.p-score.scrolling {
    transform: scale(1.15);
    /* 放大 15% */
    color: #111;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.18), 0 0 22px rgba(0, 242, 255, 0.35);
    transition: transform 0.3s ease-out, text-shadow 0.1s ease-out;
    /* 快速响应发光 */
}

/* 分数结算（变小）阶段 */
.p-score.high-glow {
    transform: scale(1.0);
    /* 回到正常大小 */
    color: #111;
    /* 保持强光晕，等待动画结束移除 */
    /* 这里 text-shadow 与 scrolling 状态一致，实现平滑过渡 */
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.18), 0 0 22px rgba(0, 242, 255, 0.35);
    /* 缩放变回正常需要平滑过渡 */
    transition: transform 0.5s ease-out;
}

/* 默认状态下 (无 .scrolling 和 .high-glow) 光晕会根据 .p-score 的 transition: text-shadow 0.8s 缓慢消失 */

.card-rank {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--rank-strip-width);
    height: 100%;
    background: var(--p-color);
    color: #000;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-card-ui);
    font-size: 30.4px;
    font-variant-numeric: lining-nums tabular-nums;
    font-feature-settings: "lnum" 1, "tnum" 1;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
    z-index: 2;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
}

.p-diff {
    position: absolute;
    bottom: 10px;
    right: 10px;
    min-width: var(--p-diff-slot-width);
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-sans);
    color: #111;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    text-align: right;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 3;
}

/* Diff 出现时：保持高亮 */
.p-diff.show {
    opacity: 1;
}

.p-diff.plus {
    color: #2e7d32;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    background: rgba(46, 125, 50, 0.12);
    border: 1px solid rgba(46, 125, 50, 0.28);
    padding: 2px 8px;
    border-radius: 999px;
}

.p-diff.minus {
    color: #f44;
    background: rgba(255, 68, 68, 0.10);
    border: 1px solid rgba(255, 68, 68, 0.26);
    padding: 2px 8px;
    border-radius: 999px;
}

body[data-mode="individual"] .card:nth-child(8n) {
    margin-right: 0;
}

/* === MOBILE PROFILE (Douyin readability) === */
body[data-profile="mobile"][data-mode="individual"] .std-wrapper {
    width: 98%;
    max-width: none;
    bottom: 24px;
    gap: 8px;
}

body[data-profile="mobile"][data-mode="individual"] .std-tip-overlay {
    bottom: calc(100% + 8px);
    /* Adjust height slightly for mobile */
    gap: 12px;
    padding: 14px 20px;
}

body[data-profile="mobile"][data-mode="individual"] .std-tip-overlay::before {
    left: 14px;
}

body[data-profile="mobile"][data-mode="individual"] .std-tip-overlay[data-tone] .std-tip-title {
    padding-left: 10px;
}

body[data-profile="mobile"][data-mode="individual"] .std-tip-title {
    font-size: 16px;
}

body[data-profile="mobile"][data-mode="individual"] .std-tip-value {
    font-size: 22px;
}

body[data-profile="mobile"][data-mode="individual"] .std-tip-note {
    font-size: 14px;
}

body[data-profile="mobile"][data-mode="individual"] .std-info-bar {
    height: 62px;
    padding: 0 20px;
}

body[data-profile="mobile"][data-mode="individual"] .std-info-bar::after {
    animation: none;
}

body[data-profile="mobile"][data-mode="individual"] .info-title {
    font-size: 24px;
}

body[data-profile="mobile"][data-mode="individual"] .info-round {
    font-size: 22px;
    padding: 6px 14px;
}

body[data-profile="mobile"][data-mode="individual"] .info-right {
    font-size: 22px;
    width: auto;
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    column-gap: 0;
}

body[data-profile="mobile"][data-mode="individual"] .map-tag {
    display: none;
}

body[data-profile="mobile"][data-mode="individual"] .map-val {
    font-size: 24px;
    white-space: nowrap;
}

body[data-profile="mobile"][data-mode="individual"] .std-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    height: 124px;
}

body[data-profile="mobile"][data-mode="individual"] .card {
    flex: 0 0 calc((100% - 42px) / 8);
    --rank-strip-width: 26px;
    min-width: 0;
    min-height: 124px;
    padding-left: 26px;
}

body[data-profile="mobile"][data-mode="individual"] .card-rank {
    width: 26px;
    font-size: 24px;
}

body[data-profile="mobile"][data-mode="individual"] .p-name {
    font-size: 27px;
    line-height: 1.14;
    margin-bottom: 3px;
}

body[data-name-tier="4"][data-mode="individual"] .p-name {
    font-size: 30px;
}

body[data-name-tier="5"][data-mode="individual"] .p-name {
    font-size: 27px;
}

@media (max-width: 1440px) {
    body:not([data-profile="mobile"])[data-mode="individual"] .p-name {
        font-size: 27px;
    }

    body:not([data-profile="mobile"])[data-name-tier="4"][data-mode="individual"] .p-name {
        font-size: 24px;
    }

    body:not([data-profile="mobile"])[data-name-tier="5"][data-mode="individual"] .p-name {
        font-size: 21px;
    }

    body:not([data-profile="mobile"])[data-mode="individual"] .p-score {
        font-size: 40px;
    }

    body:not([data-profile="mobile"])[data-mode="individual"] .p-diff {
        font-size: 20px;
        min-width: 60px;
    }

    body:not([data-profile="mobile"])[data-mode="individual"] .p-diff.plus,
    body:not([data-profile="mobile"])[data-mode="individual"] .p-diff.minus {
        padding: 1px 6px;
    }
}

body[data-profile="mobile"][data-mode="individual"] .p-score {
    font-size: 48px;
}

body[data-profile="mobile"][data-mode="individual"] .p-score.scrolling {
    transform: scale(1.08);
}

body[data-profile="mobile"][data-mode="individual"] .p-diff {
    font-size: 18px;
    min-width: 44px;
}

/* 定义动画 */
@keyframes cardEntry {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
