/* =========================================================
   英语学习平台 - 做题页段位与 MMR 实时反馈条样式表 (quiz_rank.css)
   专为手机端竖屏特化，高度紧凑 (< 40px)，防止遮挡题面 (基准 < 300 行)
   ========================================================= */

.quiz-rank-hud {
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: clamp(4px, 0.8vh, 6px) clamp(8px, 2vw, 12px);
    margin: clamp(4px, 0.6vh, 6px) 0 clamp(6px, 1.2vh, 10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    user-select: none;
    transition: border-color 0.3s ease;
    flex-shrink: 0;
}

.rank-hud-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    font-size: 0.76rem;
    line-height: 1.15;
    margin-bottom: 2px;
}

.rank-hud-left {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex-shrink: 1;
}

.hud-tier-icon {
    font-size: 0.88rem;
    line-height: 1;
    display: inline-block;
    flex-shrink: 0;
}

.hud-tier-name {
    font-weight: 800;
    font-size: 0.75rem;
    color: var(--text-main, #1e293b);
    white-space: nowrap;
    letter-spacing: -0.2px;
}

.hud-tier-stars {
    font-size: 0.72rem;
    font-weight: 900;
    color: #f59e0b;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.hud-mmr-val {
    font-weight: 800;
    color: #2563eb;
    font-size: 0.74rem;
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
    font-variant-numeric: tabular-nums;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hud-mmr-val strong {
    font-size: 0.78rem;
    font-weight: 900;
}

.hud-divider {
    color: #cbd5e1;
    font-size: 0.68rem;
}

.rank-hud-right {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    flex-shrink: 0;
}

.hud-next-tip {
    font-weight: 700;
    color: #475569;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s;
}

/* 微型流光进度槽 */
.rank-hud-track {
    position: relative;
    width: 100%;
    height: 3px;
    background: #f1f5f9;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}

.rank-hud-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f59e0b, #6366f1);
    border-radius: 3px;
    transition: width 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
    position: relative;
}

/* 内嵌学情看板 (零多余外边距与背景，极度紧凑) */
.quiz-rank-hud .live-stats-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    font-size: 0.7rem;
    color: var(--text-muted, #64748b);
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.15;
    overflow: visible;
}

.quiz-rank-hud .live-stats-bar .live-stat-item {
    font-size: 0.7rem;
}

.quiz-rank-hud .live-stats-bar .live-stat-divider {
    color: #e2e8f0;
}

/* 进度条扫光微动效 */
.rank-hud-fill::after {
    content: "";
    position: absolute;
    top: 0;
    left: -30px;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.75) 50%, rgba(255,255,255,0) 100%);
    animation: hudSweep 3.5s infinite ease-in-out;
}

@keyframes hudSweep {
    0%, 65% { left: -30px; opacity: 0; }
    70% { opacity: 1; }
    90%, 100% { left: 100%; opacity: 0; }
}

/* 答题增加动效：HUD 数据弹跳波纹 */
.hud-pulse {
    animation: hudPulseAnim 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes hudPulseAnim {
    0% { transform: scale(1); }
    40% { transform: scale(1.22); color: #1d4ed8; }
    100% { transform: scale(1); }
}

/* 升级/升段满格闪烁 */
.hud-promoted-flash {
    animation: hudPromotedFlash 0.8s ease-in-out;
}

@keyframes hudPromotedFlash {
    0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.03); }
    30%, 70% {
        box-shadow: 0 0 14px rgba(245, 158, 11, 0.65);
        border-color: #f59e0b;
        background: #fffbeb;
    }
}

/* 浮动飞向 HUD 吸收的微型药丸 */
.floating-mmr-pill {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    font-size: 0.88rem;
    font-weight: 900;
    color: #2563eb;
    background: rgba(239, 246, 255, 0.96);
    border: 1.5px solid #93c5fd;
    border-radius: 16px;
    padding: 2px 9px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    user-select: none;
}

/* 升星 / 大段位晋级全屏高亮横幅 */
.rank-promo-modal {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    z-index: 10002;
    pointer-events: none;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #f59e0b;
    border-radius: 20px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.35);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90%;
}

.rank-promo-modal.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.rank-promo-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.rank-promo-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #b45309;
    letter-spacing: 0.5px;
}

.rank-promo-sub {
    font-size: 1.05rem;
    font-weight: 900;
    color: #1e293b;
    margin-top: 1px;
}

/* 手机端极小屏适配 (iPhone SE / 375px 及以下) */
@media (max-width: 380px) {
    .quiz-rank-hud {
        padding: 5px 8px 6px;
        margin: 6px 0 4px;
    }
    .rank-hud-top {
        font-size: 0.74rem;
        gap: 4px;
    }
    .hud-tier-name {
        font-size: 0.75rem;
    }
    .hud-tier-stars {
        font-size: 0.7rem;
    }
    .rank-hud-right {
        font-size: 0.7rem;
        gap: 2px;
    }
}
