/* 
  History Page Styles 
  Vertical layout, clean card list (Timeline removed per user request).
*/

:root {
    --header-bg: #e0f2fe;
    --card-bg: #ffffff;
    --text-title: #0f172a;
    --text-body: #475569;
    --text-meta: #64748b;
    --highlight: #3b82f6;
}

/* Base Container */
.history-shell {
    padding-bottom: var(--page-block-end-space, 24px);
}

/* 1. Top Achievement Banner */
.achievement-banner {
    position: relative;
    background: white;
    border-radius: 16px;
    border: 1px solid #e6edf7;
    overflow: hidden;
    margin-bottom: 32px;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
}

.banner-bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 50%;
    background: url('/static/assets/history-header-bg.png') no-repeat right center;
    background-size: cover;
    opacity: 0.15;
    mask-image: linear-gradient(to right, transparent, black);
    -webkit-mask-image: linear-gradient(to right, transparent, black);
    pointer-events: none;
}

:root[data-theme="dark"] .achievement-banner {
    background: #121a2a;
    border-color: #2f3e56;
}

:root[data-theme="dark"] .achievement-banner .banner-bg {
    background-image: url('/static/assets/history-header-bg-dark.png');
    opacity: 0.32;
}

:root[data-theme="dark"] .score-circle {
    background:
        radial-gradient(circle at 35% 30%, rgba(120, 168, 247, 0.2), transparent 38%),
        linear-gradient(135deg, #16243a, #0f1828);
    border-color: #2f3e56;
    box-shadow:
        inset 0 0 0 1px rgba(120, 168, 247, 0.24),
        0 18px 36px rgba(0, 0, 0, 0.26);
}

:root[data-theme="dark"] .score-value {
    color: #8ab4ff;
}

:root[data-theme="dark"] .stat-item {
    background: rgba(15, 24, 40, 0.34);
    border-left-color: #405574;
    border-radius: 12px;
    padding: 18px 20px;
}

:root[data-theme="dark"] .stat-item:first-child {
    border-color: #5f8fee;
}

:root[data-theme="dark"] .empty-state {
    background: #121a2a;
    border-color: #405574;
    color: #a7b7ce;
}

.banner-content {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    padding: 32px;
    gap: 32px;
    z-index: 2;
}

/* 左侧总分大数字 */
.total-score-block {
    text-align: center;
    position: relative;
}

.score-circle {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 4px solid white;
    box-shadow: 0 0 0 1px #dbeafe, 0 10px 20px -5px rgba(59, 130, 246, 0.15);
}

.score-label {
    font-size: 13px;
    color: var(--text-meta);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.score-value {
    font-size: 48px;
    font-weight: 800;
    color: #1e40af;
    line-height: 1;
}

.score-sub {
    font-size: 12px;
    color: var(--text-meta);
    margin-top: 4px;
}

/* 右侧详细数据网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 24px;
    border-left: 3px solid #f1f5f9;
}

.stat-item:first-child {
    border-color: #3b82f6;
}

.stat-item:nth-child(2) {
    border-color: #10b981;
}

.stat-item:nth-child(3) {
    border-color: #f59e0b;
}

.stat-k {
    font-size: 13px;
    color: var(--text-meta);
    font-weight: 500;
}

.stat-v {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-title);
    font-feature-settings: "tnum";
}

.stat-roller {
    display: inline-flex;
    align-items: baseline;
    min-height: 1em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-roller-digit {
    display: inline-block;
    height: 1em;
    overflow: hidden;
    line-height: 1;
    vertical-align: bottom;
}

.stat-roller-strip {
    display: flex;
    flex-direction: column;
    will-change: transform;
    transform: translateY(0);
}

.stat-roller-step {
    display: block;
    flex: 0 0 1em;
    height: 1em;
    line-height: 1;
}

.stat-roller-separator {
    display: inline-block;
    line-height: 1;
}

/* 2. List Layout (Clean Vertical Stack) */
.timeline-section {
    display: grid;
    gap: 24px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    /* 减少下边距，因为卡片有上边距或gap */
}

.timeline-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-title);
}

.recent-list {
    display: grid;
    gap: 16px;
    /* 卡片间距 */
}

/* 单个列表项 */
.timeline-item {
    /* 移除Grid布局，直接作为卡片容器 */
    display: block;
}

/* 卡片内容主体 */
.record-card {
    background: white;
    border: 1px solid #e6edf7;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: none !important;
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 20px;
    align-items: center;
}

.record-card:hover {
    background: white !important;
    border-color: #e6edf7 !important;
    color: inherit !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
}

:root[data-theme="dark"] .record-card,
:root[data-theme="dark"] .record-card:hover {
    background: #121a2a !important;
    border-color: #2f3e56 !important;
    color: inherit !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.16) !important;
}

.record-thumb {
    width: 64px;
    height: 64px;
    margin: 0 8px;
    background: transparent;
    border-radius: 0;
    object-fit: contain;
    padding: 0;
    border: 0;
}

.history-record-enter {
    opacity: 0;
    animation: history-record-in 430ms cubic-bezier(.2, .8, .2, 1) var(--history-record-delay, 0ms) both;
}

@keyframes history-record-in {
    from { opacity: 0; transform: translateY(9px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .history-record-enter {
        opacity: 1;
        animation: none;
    }

    .stat-roller-strip {
        will-change: auto;
    }
}

.record-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.record-date {
    font-size: 13px;
    color: var(--text-meta);
    display: flex;
    align-items: center;
    gap: 8px;
}

.record-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-title);
    margin: 0;
    line-height: 1.3;
}

.record-badges {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.scoring-progress {
    width: min(520px, 100%);
    margin-top: 10px;
}

.scoring-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 7px;
    color: #47617e;
    font-size: 12px;
}

.scoring-progress-head strong {
    color: #2563c9;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.scoring-progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eef6;
}

.scoring-progress-bar {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #3b82f6;
    transition: width 320ms cubic-bezier(.2, .8, .2, 1);
}

.scoring-failed-note {
    margin-top: 10px;
    color: #9f3a38;
    font-size: 12px;
}

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f1f5f9;
    color: var(--text-meta);
    font-weight: 500;
}

.badge.score-A {
    background: #dcfce7;
    color: #166534;
}

.badge.score-B {
    background: #dbeafe;
    color: #1e40af;
}

.badge.score-C {
    background: #fef9c3;
    color: #854d0e;
}

/* 右侧操作区 */
.record-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    min-width: 120px;
}

.mini-score {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-title);
    line-height: 1;
}

.mini-score small {
    font-size: 14px;
    color: var(--text-meta);
    font-weight: normal;
}

.action-row {
    display: flex;
    gap: 8px;
}

.scoring-state {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #edf4ff;
    color: #245ca8;
    font-size: 13px;
    font-weight: 600;
}

.scoring-state.running {
    background: #e8f2ff;
    color: #1f62b4;
}

.scoring-state.failed {
    background: #fff0f0;
    color: #9f3a38;
}

.scoring-wait-note {
    color: var(--text-meta);
    font-size: 12px;
}

.recording-panel {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.recording-panel[hidden] {
    display: none !important;
}

.recording-list {
    display: grid;
    gap: 10px;
}

.recording-item {
    padding: 8px 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    display: grid;
    gap: 8px;
}

.recording-title {
    font-size: 13px;
    color: #334155;
    font-weight: 600;
}

.recording-item audio {
    width: 100%;
}

/* 空状态 */
.empty-state {
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    color: var(--text-meta);
}

/* 响应式 */
@media (max-width: 768px) {
    .banner-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 24px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-item {
        padding-left: 0;
        border-left: none;
        border-bottom: 2px solid #f1f5f9;
        padding-bottom: 8px;
        align-items: center;
    }

    .record-card {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: center;
    }

    .record-thumb {
        margin: 0 auto;
        width: 60px;
        height: 60px;
    }

    .record-actions {
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        border-top: 1px solid #f1f5f9;
        padding-top: 12px;
    }

    .scoring-progress {
        width: 100%;
    }
}
