/* ============================================================
   红旗墙 · 移动优先设计系统
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ---------- 设计变量 ---------- */
:root {
    /* 品牌色 */
    --primary:        #C8102E;
    --primary-dark:   #9B0C23;
    --primary-deep:   #7A091B;
    --primary-soft:   #FFF5F6;
    --primary-glow:   rgba(200, 16, 46, 0.18);

    /* 中性色 */
    --bg:             #F4F5F7;
    --surface:        #FFFFFF;
    --text:           #1A1D23;
    --text-secondary: #4B5563;
    --text-muted:     #9CA3AF;
    --border:         #EDEFF3;
    --border-strong:  #E1E4EA;

    /* 奖牌色 */
    --gold:           #C9A227;
    --gold-bg:        #FBF6E5;
    --silver:         #9199A6;
    --silver-bg:      #F1F3F6;
    --bronze:         #B87333;
    --bronze-bg:      #FBF1E8;

    /* 圆角 */
    --radius-sm: 10px;
    --radius:    16px;
    --radius-lg: 22px;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow:    0 4px 16px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);
    --shadow-primary: 0 6px 18px rgba(200, 16, 46, 0.22);

    /* 字号（响应式） */
    --fs-h1: clamp(22px, 5vw, 30px);
    --fs-h2: clamp(18px, 4.2vw, 24px);
    --fs-h3: clamp(16px, 3.8vw, 19px);
    --fs-body: 15px;
    --fs-sm: 13px;
    --fs-xs: 12px;
}

/* ---------- 基础排版 ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
                 Helvetica, Arial, sans-serif;
    font-size: var(--fs-body);
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ============================================================
   顶部导航
   ============================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 2px 12px rgba(200, 16, 46, 0.18);
    padding: 14px 20px;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.navbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.navbar .brand .logo {
    width: 26px; height: 26px;
    background: rgba(255, 255, 255, 0.16);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
}
.navbar .user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.14);
    padding: 5px 12px;
    border-radius: 999px;
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.navbar .user-chip .role {
    font-size: 11px;
    opacity: 0.78;
    padding-left: 6px;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
}
.navbar a.nav-link {
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.navbar a.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* ============================================================
   页面容器
   ============================================================ */
.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 20px 16px;
}

.page-header {
    margin-bottom: 20px;
}
.page-header .greeting {
    font-size: var(--fs-h1);
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.25;
    color: var(--text);
}
.page-header .greeting .accent {
    color: var(--primary);
}
.page-header .subtitle {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================================
   卡片
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.35s ease both;
}
.card + .card { animation-delay: 0.05s; }
.card h2 {
    font-size: var(--fs-h2);
    font-weight: 700;
    letter-spacing: -0.2px;
    margin-bottom: 14px;
    color: var(--text);
}
.card h3 {
    font-size: var(--fs-h3);
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 22px;
    min-height: 46px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--shadow-primary);
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
    user-select: none;
}
.btn:hover {
    color: #fff;
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(200, 16, 46, 0.28);
}
.btn:active { transform: translateY(0); }

.btn-block { display: flex; width: 100%; }
.btn-sm {
    padding: 7px 14px;
    min-height: 34px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
}
.btn-ghost {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: none;
    border: 1px solid rgba(200, 16, 46, 0.15);
}
.btn-ghost:hover {
    background: #FFE8EB;
    color: var(--primary-dark);
    filter: none;
    box-shadow: none;
}
.btn-lg { min-height: 52px; font-size: 16px; padding: 14px 26px; }

/* ============================================================
   表单
   ============================================================ */
.form-group { margin-bottom: 16px; }
label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    letter-spacing: 0.2px;
}

/* 统一所有文本类输入框（含 tel / search / url / date 等） */
input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=reset]):not([type=file]):not([type=image]):not([type=color]):not([type=range]),
select,
textarea {
    width: 100%;
    padding: 13px 14px;
    min-height: 48px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: #FAFBFC;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    line-height: 1.4;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px var(--primary-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }

select {
    background-image:
        url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    padding-right: 42px;
}

/* 一行式表单：label 左，输入框右 */
.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.form-row > label {
    flex: 0 0 76px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
    text-align: right;
    white-space: nowrap;
}
.form-row > input,
.form-row > select {
    flex: 1;
    width: auto;
    min-width: 0;
    margin-bottom: 0;
    min-height: 44px;
    padding: 0 12px;
    font-size: 15px;
    box-sizing: border-box;
}

/* 居中表单页 */
.form-card {
    max-width: 460px;
    margin: 32px auto;
    padding: 32px 26px;
}
.form-card h2 {
    text-align: center;
    margin-bottom: 24px;
}
.form-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================================
   班级码 + 二维码区
   ============================================================ */
.code-box {
    position: relative;
    text-align: center;
    padding: 26px 20px;
    background:
        radial-gradient(circle at top right, rgba(200,16,46,0.06), transparent 60%),
        linear-gradient(180deg, #FFFDFD 0%, #FFF8F9 100%);
    border: 1.5px dashed rgba(200, 16, 46, 0.28);
    border-radius: var(--radius);
    overflow: hidden;
}
.code-box .code-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}
.code-box .code {
    font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
    font-size: clamp(20px, 6vw, 30px);
    font-weight: 800;
    letter-spacing: 4px;
    padding-left: 4px;
    color: var(--primary);
    line-height: 1.2;
    text-shadow: 0 2px 6px rgba(200, 16, 46, 0.12);
    word-break: break-all;
}
.code-box .qr-wrap {
    display: inline-block;
    margin-top: 18px;
    padding: 10px;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.code-box .qr-wrap img {
    display: block;
    width: 168px;
    height: 168px;
    border-radius: 6px;
}
.code-box .hint {
    margin-top: 12px;
    font-size: var(--fs-sm);
    color: var(--text-muted);
}
.code-box .hint strong { color: var(--primary); font-weight: 600; }

/* ============================================================
   红旗榜表格
   ============================================================ */
.rank-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.rank-table th,
.rank-table td {
    padding: 14px 12px;
    text-align: left;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.rank-table th {
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    background: #FAFBFC;
}
.rank-table tr:last-child td { border-bottom: none; }
.rank-table tbody tr { transition: background 0.15s; }
.rank-table tbody tr:hover td { background: #FAFBFC; }

.rank-table .rank-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}
.rank-table .rank-1 .rank-num {
    background: linear-gradient(135deg, #F4D97B, var(--gold));
    color: #fff;
    box-shadow: 0 3px 8px rgba(201, 162, 39, 0.35);
}
.rank-table .rank-2 .rank-num {
    background: linear-gradient(135deg, #C9CFDA, var(--silver));
    color: #fff;
    box-shadow: 0 3px 8px rgba(145, 153, 166, 0.3);
}
.rank-table .rank-3 .rank-num {
    background: linear-gradient(135deg, #D9A06C, var(--bronze));
    color: #fff;
    box-shadow: 0 3px 8px rgba(184, 115, 51, 0.3);
}
.rank-table .name {
    font-weight: 600;
    color: var(--text);
}
.rank-table .score {
    color: var(--primary);
    font-weight: 800;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}
.rank-table .score::after {
    content: "🚩";
    font-size: 12px;
    margin-left: 3px;
    opacity: 0.85;
}
.rank-table .times {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.rank-table td:last-child { text-align: right; }

/* ============================================================
   班级列表（首页）
   ============================================================ */
.class-list {
    list-style: none;
    display: grid;
    gap: 12px;
}
.class-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.class-list li:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: rgba(200, 16, 46, 0.18);
}
.class-list a.class-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 600;
    font-size: 16px;
    min-width: 0;
}
.class-list a.class-link .avatar {
    flex: 0 0 38px;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(200, 16, 46, 0.25);
}
.class-list a.class-link .class-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.class-list .code-tag {
    flex-shrink: 0;
    font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid rgba(200, 16, 46, 0.14);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 1px;
}

/* ============================================================
   提示 / 空状态
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-error {
    background: #FEF3F3;
    color: #B0241D;
    border-color: #FAD9D9;
}
.alert-info {
    background: #EEF5FF;
    color: #1A5FB4;
    border-color: #D8E7FB;
}

.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}
.empty::before {
    content: "🗒️";
    display: block;
    font-size: 34px;
    margin-bottom: 10px;
    opacity: 0.65;
}

/* ============================================================
   工具类
   ============================================================ */
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.hide-sm { display: table-cell; }

/* ============================================================
   动画
   ============================================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   小屏适配
   ============================================================ */
@media (max-width: 640px) {
    .container { padding: 16px 14px; }
    .card { padding: 18px 16px; border-radius: 14px; }

    .navbar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
    .navbar .brand { font-size: 15.5px; }
    .navbar .brand .logo { width: 24px; height: 24px; font-size: 13px; }
    .navbar .nav-right { gap: 10px; font-size: 13px; }
    .navbar .user-chip { max-width: 96px; padding: 4px 10px; font-size: 12.5px; }
    .navbar .user-chip .role { display: none; }

    .code-box { padding: 22px 14px; }
    .code-box .code { letter-spacing: 3px; }
    .code-box .qr-wrap img { width: 148px; height: 148px; }

    .rank-table th, .rank-table td { padding: 12px 8px; }
    .rank-table .hide-sm { display: none; }
    .rank-table .score { font-size: 17px; }

    .class-list a.class-link { font-size: 15px; }
    .class-list .code-tag { font-size: 12px; padding: 4px 8px; }

    /* 一行式表单：窄屏缩短 label */
    .form-row > label { flex: 0 0 64px; font-size: 13.5px; }
    .form-row > input,
    .form-row > select { min-height: 42px; font-size: 14.5px; }
}

/* 大屏优化 */
@media (min-width: 900px) {
    .container { padding: 28px 20px; }
    .card { padding: 28px 26px; }
    .code-box { padding: 32px 24px; }
    .code-box .code { letter-spacing: 6px; }
    .code-box .qr-wrap img { width: 184px; height: 184px; }
}

/* ============================================================
   App 风格底部 Tab 栏
   ============================================================ */
.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    pointer-events: none;
    padding: 0 12px calc(10px + env(safe-area-inset-bottom, 0px));
}
.tabbar-inner {
    pointer-events: auto;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border: 1px solid rgba(16, 24, 40, 0.06);
    border-radius: 22px;
    box-shadow:
        0 8px 24px rgba(16, 24, 40, 0.10),
        0 2px 6px rgba(16, 24, 40, 0.05);
    padding: 6px;
    gap: 2px;
}
.tabbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 6px 7px;
    border-radius: 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: color 0.18s, background 0.18s, transform 0.18s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    min-height: 56px;
}
.tabbar-item svg {
    width: 22px;
    height: 22px;
    transition: transform 0.18s ease, color 0.18s;
}
.tabbar-item span {
    font-size: 11px;
    line-height: 1;
}
.tabbar-item:hover {
    color: var(--text-secondary);
    background: rgba(16, 24, 40, 0.03);
}
.tabbar-item:active svg {
    transform: scale(0.9);
}
.tabbar-item.active {
    color: var(--primary);
    font-weight: 600;
}
.tabbar-item.active svg {
    transform: translateY(-1px) scale(1.05);
    filter: drop-shadow(0 3px 6px rgba(200, 16, 46, 0.28));
}
.tabbar-item.active::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
}

/* body 底部留出 Tab 栏高度 */
body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* 移动端微调 */
@media (max-width: 640px) {
    .tabbar { padding: 0 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
    .tabbar-inner { border-radius: 20px; padding: 5px; }
    .tabbar-item { min-height: 52px; padding: 7px 4px 6px; }
    .tabbar-item svg { width: 21px; height: 21px; }
    .tabbar-item span { font-size: 10.5px; }
}

/* ============================================================
   学生详情弹窗
   ============================================================ */
.student-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(200, 16, 46, 0.35);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.student-link:hover,
.student-link:focus {
    color: var(--primary);
    border-bottom-color: var(--primary);
    outline: none;
}

.student-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.student-modal-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(16, 24, 40, 0.25);
    animation: smIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes smIn {
    from { transform: translateY(12px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}
.student-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    z-index: 1;
}
.student-modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.sm-close {
    background: #F4F5F7;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.sm-close:hover { background: #E1E4EA; }

.student-modal-body { padding: 18px 20px 22px; }

.sm-section {
    background: #FAFBFC;
    border-radius: 12px;
    padding: 2px 14px;
    margin-bottom: 14px;
}
.sm-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14.5px;
}
.sm-row:last-child { border-bottom: none; }
.sm-k {
    flex: 0 0 68px;
    color: var(--text-muted);
    font-size: 13.5px;
}
.sm-v {
    flex: 1;
    color: var(--text);
    font-weight: 500;
    word-break: break-all;
}

.sm-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 4px 0 6px;
    padding-left: 2px;
}

.sm-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.sm-stat {
    flex: 1;
    background: linear-gradient(180deg, #FFFDFD 0%, #FFF8F9 100%);
    border: 1px dashed rgba(200, 16, 46, 0.22);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
}
.sm-stat-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.sm-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sm-records {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sm-records li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.sm-records li:last-child { border-bottom: none; }
.sm-rec-reason { color: var(--text-secondary); }
.sm-rec-points {
    color: var(--primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .student-modal { padding: 14px; }
    .student-modal-box { max-height: 88vh; border-radius: 14px; }
    .student-modal-header { padding: 14px 16px 10px; }
    .student-modal-body { padding: 14px 16px 18px; }
    .sm-k { flex: 0 0 60px; font-size: 13px; }
    .sm-v { font-size: 14px; }
    .sm-stat-num { font-size: 22px; }
}

/* ============================================================
   首页班级卡：右侧操作按钮
   ============================================================ */
.class-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: #FAFBFC;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    user-select: none;
    padding: 0;
    font-family: inherit;
}
.icon-btn:hover {
    background: #fff;
    border-color: rgba(200, 16, 46, 0.35);
    color: var(--primary);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn-danger:hover {
    background: #FEF3F3;
    border-color: #FAD9D9;
    color: #B0241D;
}

.pending-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(200, 16, 46, 0.35);
}

/* 小屏：班级卡允许换行 */
@media (max-width: 480px) {
    .class-list li { flex-wrap: wrap; }
    .class-actions { gap: 4px; }
    .icon-btn { width: 30px; height: 30px; font-size: 13px; }
    .class-list .code-tag { font-size: 11px; padding: 3px 6px; }
}

/* ============================================================
   首页底部：友情链接（灰色卡片）
   ============================================================ */
.friend-links {
    background: #F0F1F4;
    border: 1px solid #E4E6EB;
    border-radius: 16px;
    padding: 18px 20px;
    margin: 20px 0 10px;
}
.friend-links-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #9CA3AF;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 12px;
    text-align: center;
}
.friend-links-body {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}
.fl-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #E4E6EB;
    border-radius: 12px;
    color: #4B5563;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s, color 0.15s;
    min-width: 200px;
    justify-content: center;
}
.fl-item:hover {
    color: #C8102E;
    border-color: rgba(200, 16, 46, 0.28);
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.06);
    transform: translateY(-1px);
}
.fl-icon {
    font-size: 16px;
    line-height: 1;
}
.fl-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.fl-desc {
    font-size: 12px;
    color: #9CA3AF;
    padding-left: 8px;
    border-left: 1px solid #E4E6EB;
}

@media (max-width: 640px) {
    .friend-links {
        padding: 14px 14px;
        border-radius: 14px;
    }
    .fl-item {
        min-width: 0;
        width: 100%;
        padding: 10px 14px;
    }
    .fl-desc { font-size: 11.5px; }
}
/* ============================================================
   班级成员列表
   ============================================================ */

/* 移动端卡片 */
.member-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.member-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.35s ease both;
}
.member-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.member-rank {
    flex: 0 0 34px;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.member-rank.rank-1 {
    background: linear-gradient(135deg, #F4D97B, var(--gold));
    color: #fff;
    box-shadow: 0 3px 8px rgba(201, 162, 39, 0.35);
}
.member-rank.rank-2 {
    background: linear-gradient(135deg, #C9CFDA, var(--silver));
    color: #fff;
    box-shadow: 0 3px 8px rgba(145, 153, 166, 0.3);
}
.member-rank.rank-3 {
    background: linear-gradient(135deg, #D9A06C, var(--bronze));
    color: #fff;
    box-shadow: 0 3px 8px rgba(184, 115, 51, 0.3);
}
.member-name-wrap { flex: 1; min-width: 0; }
.member-name {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 4px;
}
.member-badge-leader { font-size: 14px; }
.member-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}
.member-points {
    flex: 0 0 auto;
    text-align: right;
    line-height: 1;
}
.member-points-num {
    color: var(--primary);
    font-size: 22px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.member-points-label {
    font-size: 12px;
    color: var(--primary);
    margin-left: 2px;
}
.member-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 13.5px;
}
.meta-label {
    flex: 0 0 34px;
    color: var(--text-muted);
    font-size: 12.5px;
}
.meta-value {
    flex: 1;
    min-width: 0;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.phone-link {
    color: var(--primary);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    font-family: "SF Mono", ui-monospace, monospace;
    letter-spacing: 0.3px;
}
.phone-link:hover { text-decoration: underline; }
.team-chip {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

/* 桌面端表格默认隐藏 */
.member-table-card { display: none; }

/* 屏幕 >= 720px：显示表格，隐藏卡片 */
@media (min-width: 720px) {
    .member-list { display: none; }
    .member-table-card { display: block; }
}