/* ===== 通用组件：卡片 / 列表 / 标签 / 按钮 / 排名 / 弹窗 ===== */

/* 学期头 */
.term-hd { padding: 10px 20px; font-weight: 700; font-size: 13px; color: var(--primary); background: rgba(238, 241, 255, .92); backdrop-filter: blur(12px); display: flex; align-items: center; gap: 6px; position: sticky; top: 48px; z-index: 1; cursor: pointer; user-select: none; margin-top: 8px; border-top: 1px solid var(--border); }
.sheet-scroll .term-hd { top: 0; }
.term-hd .badge { font-size: 10px; background: var(--green); color: #fff; padding: 1px 6px; border-radius: 3px; font-weight: 600; }
.term-hd .arrow { font-size: 10px; transition: transform .25s; margin-right: 2px; }
.term-hd.collapsed .arrow { transform: rotate(-90deg); }

/* 班课列表项 */
.cc-item { padding: 12px 20px; cursor: pointer; border-bottom: 1px solid #f8f8f8; transition: all .15s; display: flex; align-items: center; gap: 10px; }
.cc-item:hover { background: var(--primary-light); }
.cc-item:active { background: #e0e5ff; }
.cc-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.cc-item .info { flex: 1; min-width: 0; }
.cc-item .name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-item .meta { font-size: 11px; color: var(--text3); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* 标签 */
.tag { display: inline-block; padding: 0 5px; border-radius: 3px; font-size: 10px; line-height: 18px; }
.tag-open { background: #f6ffed; color: var(--green); border: 1px solid #b7eb8f; }
.tag-closed { background: #fff1f0; color: var(--red); border: 1px solid #ffa39e; }
.tag-other { background: #f0f0f0; color: var(--text3); border: 1px solid #e0e0e0; }

/* 卡片 */
.card { background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-hd { padding: 14px 16px 10px; font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-hd::before { content: ''; width: 3px; height: 16px; background: var(--primary); border-radius: 2px; }
.card-bd { padding: 0 16px 12px; }

/* 统计格 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: 10px; padding: 16px 12px; text-align: center; color: #fff; }
.stat .val { font-size: 26px; font-weight: 800; }
.stat .lbl { font-size: 11px; opacity: .8; margin-top: 2px; }
.stat.green { background: linear-gradient(135deg, #52c41a, #389e0d); }

/* 数据列表 */
.data-list { display: flex; flex-direction: column; gap: 0; }
.data-group { background: rgba(238, 241, 255, .92); backdrop-filter: blur(12px); padding: 10px 16px; font-weight: 700; font-size: 13px; color: var(--primary); display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; transition: background .15s; }
.data-group:hover { background: #dce3ff; }
.data-group:active { background: #d0d9ff; }
.data-group .arrow { font-size: 10px; transition: transform .25s; }
.data-group.collapsed .arrow { transform: rotate(-90deg); }
.data-group .cnt { font-weight: 400; font-size: 11px; color: var(--text3); margin-left: auto; }
.data-row.collapsed, .cc-item.collapsed { display: none; }
.data-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f5f5f5; transition: background .15s; }
.data-row:last-child { border-bottom: none; }
.data-row:hover { background: #fafbfc; }
.data-row.me { background: #fffbe6; }
.data-row .rank { width: 36px; flex-shrink: 0; text-align: center; font-weight: 800; font-size: 16px; color: var(--text3); }
.data-row .main-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.data-row .title { font-size: 14px; font-weight: 600; line-height: 1.4; }
.data-row .subtitle { font-size: 12px; color: var(--text3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; line-height: 1.5; }
.data-row .scores { display: flex; align-items: center; gap: 8px; flex-shrink: 0; min-width: 60px; justify-content: flex-end; }
.data-row .my-score { font-size: 20px; font-weight: 800; color: var(--green); }
.data-row .my-score.none { color: var(--text3); font-size: 14px; font-weight: 500; }
.data-row .max-score { font-size: 13px; color: var(--text3); }

/* 排名行 */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f5f5f5; transition: background .15s; }
.rank-row:last-child { border-bottom: none; }
.rank-row:hover { background: #fafbfc; }
.rank-row.me { background: #fffbe6; }
.rank-row .rank { width: 40px; flex-shrink: 0; text-align: center; font-weight: 800; font-size: 16px; }
.rank-row .rank.r1 { color: #ffcf26; font-size: 20px; }
.rank-row .rank.r2 { color: #b0b0b0; font-size: 18px; }
.rank-row .rank.r3 { color: #ff8c38; font-size: 18px; }
.rank-row .r-info { flex: 1; min-width: 0; }
.rank-row .r-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .r-no { font-size: 12px; color: var(--text3); margin-top: 1px; }
.rank-row .r-score { font-size: 20px; font-weight: 800; color: var(--primary); flex-shrink: 0; min-width: 48px; text-align: right; }
.rank-row .r-time { font-size: 12px; color: var(--text3); flex-shrink: 0; min-width: 60px; text-align: right; }
.rank-row .r-status { flex-shrink: 0; font-size: 14px; }

/* 进度条 */
.score-bar { height: 4px; background: #f0f0f0; border-radius: 2px; margin-top: 4px; overflow: hidden; }
.score-bar .fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }
.score-bar .fill.green { background: linear-gradient(90deg, var(--green), #389e0d); }

/* 领奖台 */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin-bottom: 20px; padding: 16px 0; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pod .avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; }
.pod:nth-child(1) .avatar { background: #b0b0b0; width: 44px; height: 44px; font-size: 18px; }
.pod:nth-child(2) .avatar { background: #ffcf26; width: 54px; height: 54px; font-size: 22px; }
.pod:nth-child(3) .avatar { background: #ff8c38; width: 48px; height: 48px; font-size: 20px; }
.pod .pname { font-size: 12px; font-weight: 600; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pscore { font-size: 14px; font-weight: 800; color: var(--primary); }
.pod .bar { border-radius: 6px 6px 0 0; width: 60px; }
.pod:nth-child(1) .bar { height: 40px; background: linear-gradient(180deg, #d9d9d9, #b0b0b0); }
.pod:nth-child(2) .bar { height: 60px; background: linear-gradient(180deg, #ffe066, #ffcf26); }
.pod:nth-child(3) .bar { height: 48px; background: linear-gradient(180deg, #ffb366, #ff8c38); }

/* 提示条 */
.tip { padding: 10px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.tip-blue { background: var(--primary-light); color: var(--primary); }
.tip-yellow { background: #fffbe6; color: #d48806; }

/* 下拉选择器 */
.selector { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--card); color: var(--text); appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23999'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border-radius: 8px; border: none; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* 空状态 / 加载 */
.empty-box { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; color: var(--text3); }
.empty-box .inner { background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px); border-radius: 16px; padding: 48px 40px; box-shadow: 0 8px 32px rgba(0, 0, 0, .12); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.empty-box .icon { font-size: 56px; }
.empty-box p { font-size: 15px; color: var(--text2); }
.loading-box { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 40vh; color: var(--text3); }
.loading-box .inner { background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px); border-radius: 16px; padding: 48px 40px; box-shadow: 0 8px 32px rgba(0, 0, 0, .12); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.spinner { width: 32px; height: 32px; border: 3px solid #e8e8e8; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-box p { font-size: 14px; color: var(--text2); }

/* 弹窗 / Sheet */
.sheet-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 100; display: none; opacity: 0; transition: opacity .25s; }
.sheet-mask.show { display: block; opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 70vh; background: rgba(255, 255, 255, .95); backdrop-filter: blur(12px); border-radius: 16px 16px 0 0; z-index: 101; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .3s cubic-bezier(.4, 0, .2, 1); }
.sheet.show { transform: translateY(0); }
.sheet-hd { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.sheet-hd .close { width: 28px; height: 28px; border-radius: 50%; background: #f0f0f0; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; color: var(--text3); }
.sheet-scroll { overflow-y: auto; flex: 1; padding-bottom: env(safe-area-inset-bottom); }

/* 成员详情弹窗 */
.detail-sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 85vh; background: rgba(255, 255, 255, .98); backdrop-filter: blur(12px); border-radius: 16px 16px 0 0; z-index: 200; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .3s cubic-bezier(.4, 0, .2, 1); }
.detail-sheet.show { transform: translateY(0); }
.detail-sheet-hd { padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.detail-sheet-scroll { overflow-y: auto; flex: 1; padding: 12px 16px; }
.clickable-row { cursor: pointer; }