* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

html {
    font-size: 18px;
}

body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: #eef1f5;
    color: #1f2733;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============ 顶部标题 ============ */
.topbar {
    background: #1a5fb4;
    color: #fff;
    padding: 18px 16px;
    text-align: center;
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ============ 统计卡片 ============ */
.stats-card {
    background: #fff;
    margin: 14px 12px;
    border-radius: 14px;
    padding: 18px 14px 14px;
    box-shadow: 0 2px 8px rgba(31, 39, 51, 0.08);
}

.stats-row {
    display: flex;
    justify-content: space-around;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-num {
    font-size: 38px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-num.green {
    color: #1f9340;
}

.stat-num.orange {
    color: #e0650b;
}

.stat-label {
    font-size: 17px;
    color: #5a6572;
    margin-top: 2px;
}

.progress-bar {
    height: 14px;
    background: #e6e9ee;
    border-radius: 7px;
    margin-top: 16px;
    overflow: hidden;
}

.progress-inner {
    height: 100%;
    background: linear-gradient(90deg, #2a9d46, #46b95f);
    border-radius: 7px;
    transition: width .4s ease;
}

.progress-text {
    text-align: right;
    font-size: 16px;
    color: #5a6572;
    margin-top: 6px;
}

/* ============ 告警条 ============ */
.alert-bar {
    margin: 0 12px 10px;
    background: #fdecea;
    color: #c62828;
    border: 1px solid #f5c2c0;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 17px;
}

/* ============ 主体步骤 ============ */
.page-main {
    padding: 0 12px 28px;
}

.step {
    background: #fff;
    border-radius: 14px;
    padding: 18px 16px 22px;
    box-shadow: 0 2px 8px rgba(31, 39, 51, 0.08);
    margin-bottom: 14px;
}

.step-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.step-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: #1a5fb4;
    color: #fff;
    border-radius: 50%;
    font-size: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

.step-subtitle {
    font-size: 17px;
    color: #5a6572;
    margin: -6px 0 14px 44px;
}

/* ============ 搜索框 ============ */
.search-box {
    width: 100%;
    height: 54px;
    border: 2px solid #cdd5df;
    border-radius: 10px;
    font-size: 19px;
    padding: 0 14px;
    background: #f8fafc;
    color: #1f2733;
}

.search-box:focus {
    outline: none;
    border-color: #1a5fb4;
    background: #fff;
}

/* ============ 学生列表 ============ */
.student-list {
    margin-top: 14px;
    border: 1px solid #e4e8ee;
    border-radius: 10px;
    overflow: hidden;
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.student-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 62px;
    padding: 12px 16px;
    font-size: 20px;
    border-bottom: 1px solid #eef1f5;
    cursor: pointer;
    background: #fff;
}

.student-item:last-child {
    border-bottom: none;
}

.student-item:active {
    background: #e8f1fb;
}

.student-item .s-name {
    font-weight: 600;
}

.student-item .s-class {
    color: #5a6572;
    font-size: 17px;
    margin-left: 10px;
    font-weight: 400;
}

.student-item .s-badge {
    color: #1f9340;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

.student-item .s-right {
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
}

.s-reupload {
    border: 2px solid #1a5fb4;
    background: #fff;
    color: #1a5fb4;
    border-radius: 9px;
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
    padding: 10px 16px;
    cursor: pointer;
}

.s-reupload:active {
    background: #e8f1fb;
}

.student-item.uploaded {
    background: #f5f7f9;
    color: #98a2af;
    cursor: not-allowed;
}

.student-item.uploaded .s-name,
.student-item.uploaded .s-class {
    color: #98a2af;
}

.student-item.selected {
    background: #e3effc;
    box-shadow: inset 0 0 0 2px #1a5fb4;
}

.letter-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #e9eef4;
    color: #1a5fb4;
    font-size: 19px;
    font-weight: 700;
    padding: 8px 16px;
    border-bottom: 1px solid #dbe1e8;
}

.list-loading,
.list-empty {
    padding: 26px 16px;
    text-align: center;
    color: #8a94a2;
    font-size: 18px;
}

/* ============ 已选提示条 ============ */
.selected-bar {
    background: #e3effc;
    border: 1px solid #b9d6f5;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 19px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.selected-bar b {
    color: #1a5fb4;
    font-size: 21px;
}

.link-btn {
    background: none;
    border: none;
    color: #1a5fb4;
    font-size: 18px;
    padding: 6px 4px;
    cursor: pointer;
}

/* ============ 拍照提示 ============ */
.photo-tips {
    background: #fff8ec;
    border: 1px solid #f7dfa9;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.photo-tips p {
    margin: 4px 0;
    font-size: 19px;
    color: #7a5310;
}

/* ============ 按钮 ============ */
.btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 12px;
    font-size: 21px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}

.btn-big {
    height: 62px;
    line-height: 62px;
    margin-top: 14px;
}

.btn-primary {
    background: #1a5fb4;
    color: #fff;
}

.btn-primary:active {
    background: #164f96;
}

.btn-secondary {
    background: #fff;
    color: #1a5fb4;
    border: 2px solid #1a5fb4;
}

.btn-secondary:active {
    background: #e8f1fb;
}

.btn-danger {
    background: #d4322f;
    color: #fff;
}

.btn-danger:active {
    background: #b82826;
}

.btn-text {
    background: none;
    color: #5a6572;
    font-size: 19px;
    height: 52px;
    margin-top: 6px;
}

.btn-half {
    width: 48%;
    height: 58px;
}

/* ============ 裁剪 ============ */
.crop-tip {
    font-size: 18px;
    color: #5a6572;
    margin: 0 0 12px;
}

.crop-wrap {
    width: 100%;
    height: 60vh;
    max-height: 460px;
    background: #2b2f36;
    border-radius: 10px;
    overflow: hidden;
}

.crop-wrap img {
    max-width: 100%;
    display: block;
}

.zoom-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.btn-zoom {
    flex: 1;
    height: 54px;
    font-size: 20px;
    font-weight: 600;
    background: #f0f3f7;
    color: #1f2733;
    border-radius: 10px;
}

.btn-zoom:active {
    background: #dfe5ec;
}

/* ============ 弹窗通用 ============ */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(20, 26, 36, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 24px 20px 20px;
}

.modal-title {
    font-size: 23px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 14px;
}

.modal-body {
    text-align: center;
    margin-bottom: 20px;
}

.modal-desc {
    font-size: 20px;
    color: #1f2733;
}

.modal-name {
    font-size: 34px;
    font-weight: 800;
    color: #1a5fb4;
    margin: 8px 0;
    letter-spacing: 4px;
}

.modal-warn {
    margin-top: 14px;
    font-size: 20px;
    font-weight: 700;
    color: #d4322f;
}

.modal-btns {
    display: flex;
    justify-content: space-between;
}

/* ============ Loading ============ */
.loading-box {
    background: #fff;
    border-radius: 14px;
    padding: 28px 32px;
    text-align: center;
}

.spinner {
    width: 46px;
    height: 46px;
    border: 5px solid #dbe4ee;
    border-top-color: #1a5fb4;
    border-radius: 50%;
    margin: 0 auto 14px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 19px;
}

/* ============ 结果页 ============ */
.result-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 26px 20px 22px;
    text-align: center;
}

.success-icon {
    margin-bottom: 6px;
}

.success-circle {
    stroke: #2a9d46;
    stroke-width: 3;
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    animation: drawCircle .5s ease forwards;
}

.success-check {
    stroke: #2a9d46;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: drawCheck .35s .4s ease forwards;
}

@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}

.result-title {
    font-size: 26px;
    font-weight: 800;
    color: #1f9340;
    margin-bottom: 16px;
}

.result-thumbs {
    display: flex;
    justify-content: center;
    gap: 22px;
    margin-bottom: 20px;
}

.thumb-item {
    text-align: center;
}

.thumb-item img {
    display: block;
    border: 1px solid #e0e5eb;
    border-radius: 8px;
    object-fit: cover;
}

#thumbPhoto {
    width: 84px;
    height: 121px;
}

#thumbOriginal {
    width: 121px;
    height: 121px;
    object-fit: contain;
    background: #f5f7f9;
}

.thumb-item span {
    display: block;
    font-size: 17px;
    color: #5a6572;
    margin-top: 6px;
}

.result-box .btn-big {
    margin-top: 0;
}

/* ============ Toast ============ */
.toast {
    position: fixed;
    left: 50%;
    bottom: 14%;
    transform: translateX(-50%);
    background: rgba(30, 36, 46, 0.92);
    color: #fff;
    font-size: 19px;
    padding: 14px 22px;
    border-radius: 10px;
    max-width: 86%;
    text-align: center;
    z-index: 200;
}
