* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
    background: #eef1f6;
    min-height: 100vh;
    padding: 14px;
}

.container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 430px;
    margin: 0 auto;
    align-items: stretch;
}

.form-section {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    position: static;
    order: 1;
}

.upload-panel {
    border: 0;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
    background: transparent;
    text-align: center;
}

.upload-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    min-height: 0;
    margin: 0 auto;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #dcecff 100%);
    color: #174f9f;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(23, 79, 159, 0.18);
}

.file-pick-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    padding: 9px 14px;
    border: 1px solid #d7deea;
    border-radius: 999px;
    background: #ffffff;
    color: #2f3440;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(47, 52, 64, 0.08);
}

.camera-icon {
    line-height: 1;
}

#cameraUpload {
    display: none;
}

.crop-panel {
    margin-top: 14px;
}

.crop-stage {
    position: relative;
    width: min(320px, 88vw);
    height: min(356px, 98vw);
    margin: 0 auto;
    overflow: hidden;
    border-radius: 18px;
    background: #dbe4ef;
    touch-action: none;
}

.crop-stage img {
    position: absolute;
    left: 50%;
    top: 50%;
    max-width: none;
    transform: translate(-50%, -50%);
    user-select: none;
    -webkit-user-select: none;
}

.crop-frame {
    position: absolute;
    inset: 8%;
    border: 2px solid rgba(255, 255, 255, 0.96);
    border-radius: 12px;
    box-shadow: 0 0 0 999px rgba(9, 18, 31, 0.32);
    pointer-events: none;
}

.crop-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.crop-btn {
    border: 0;
    border-radius: 999px;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: 800;
}

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

.crop-btn.ghost {
    background: #fff;
    color: #2f3440;
}

.ocr-status {
    margin-top: 10px;
    color: #697386;
    font-size: 12px;
    text-align: center;
}

.ocr-progress {
    width: min(260px, 82vw);
    height: 8px;
    margin: 9px auto 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(178, 193, 215, 0.42);
}

.ocr-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2f7ddf 0%, #55c3ff 100%);
    transition: width 180ms ease;
}

.ocr-text {
    width: 100%;
    min-height: 86px;
    resize: vertical;
    margin-top: 8px;
    padding: 9px 10px;
    border: 1px solid #d7deea;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
    background: #ffffff;
}

.ocr-text {
    display: none;
}

.preview-section {
    display: block;
    width: 100%;
    order: 2;
}

.labels-title {
    margin: 0;
    color: #2f3440;
    font-size: 15px;
    font-weight: 800;
}

.labels-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 2px 10px;
}

.sort-select {
    max-width: 150px;
    padding: 8px 10px;
    border: 1px solid #d7deea;
    border-radius: 999px;
    background: #fff;
    color: #2f3440;
    font-size: 12px;
    font-weight: 700;
}

.clear-labels-btn {
    border: 1px solid #d7deea;
    border-radius: 999px;
    background: #fff;
    color: #697386;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 800;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.stat-card {
    padding: 10px 8px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 6px 20px rgba(33, 55, 84, 0.08);
    text-align: center;
}

.stat-value {
    display: block;
    color: #172235;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
}

.stat-label {
    display: block;
    margin-top: 5px;
    color: #697386;
    font-size: 11px;
    font-weight: 700;
}

.labels-waterfall {
    --label-gap: 10px;
    --label-width: min(170px, calc((100vw - 38px) / 2));
    display: grid;
    grid-template-columns: repeat(2, var(--label-width));
    justify-content: center;
    gap: 12px var(--label-gap);
    width: 100%;
}

.label-card-shell {
    position: relative;
    display: block;
    width: var(--label-width);
    max-width: 100%;
    margin: 0;
}

.label-card-shell .white-tag {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 45 / 50;
    transform: none;
    transform-origin: initial;
}

.label-card-shell .label-card {
    width: var(--label-width);
    height: calc(var(--label-width) * 50 / 45);
    max-width: 100%;
    transform: none;
}

.empty-labels {
    display: block;
    column-span: all;
    padding: 18px 14px;
    border: 1px dashed #c6d4e6;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.74);
    color: #697386;
    font-size: 13px;
    text-align: center;
}

.white-tag {
    width: 45mm;
    height: 50mm;
    background: #b3dbef;
    border: 0;
    border-radius: 6px;
    box-shadow: none;
    position: absolute;
    left: 50%;
    top: 10px;
    padding: 0;
    transform: translateX(-50%) scale(2.08);
    transform-origin: top center;
    z-index: 2;
    overflow: hidden;
}

.white-tag.original-image-only > * {
    display: none;
}

.white-tag.overlay-alignment .absolute {
    opacity: 1;
}

/* 绝对定位通用类 */
.absolute {
    position: absolute;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.greeting {
    font-size: 8px;
    color: #000;
    font-weight: 800;
    white-space: nowrap;
}

.luckin-logo {
    width: 30px;
    height: 26px;
    display: none;
}

.blank-slot {
    background: transparent;
    border: 0;
}

.label-logo-img {
    display: none;
}

.qr-img {
    display: none;
}

.qrcode-placeholder {
    display: none;
    width: 0;
    height: 0;
}

.order-line {
    display: flex;
    align-items: flex-start;
    width: 88px;
    height: 25px;
    overflow: visible;
}

.order-number {
    font-size: 25px;
    font-weight: 900;
    color: #000;
    letter-spacing: 0;
    line-height: 0.92;
}

.order-meta {
    display: flex;
    flex-direction: column;
    gap: 1.4px;
    margin-left: 3px;
    padding-top: 6.2px;
}

.delivery {
    font-size: 6.2px;
    color: #000;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.cup-num {
    font-size: 5.8px;
    color: #000;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.drink-name {
    font-size: 10px;
    font-weight: 900;
    color: #000;
    width: 132px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.drink-spec {
    font-size: 9px;
    color: #000;
    font-weight: 900;
    white-space: nowrap;
}

.drink-flavor {
    font-size: 7.5px;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    width: 82px;
}

.divider {
    height: 1px;
    background: repeating-linear-gradient(90deg, #000 0 1px, transparent 1px 3px);
}

.info-title {
    font-size: 6px;
    color: #000;
    font-weight: 800;
    white-space: nowrap;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-size: 6.2px;
    color: #000;
    line-height: 1.18;
    white-space: nowrap;
    text-align: center;
}

.nutrition-separator {
    width: 1px;
    height: 13px;
    background: #000;
}

.info-note {
    font-size: 5.5px;
    color: #000;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    letter-spacing: 0;
}

.footer-line {
    display: flex;
    align-items: flex-start;
    gap: 2px;
    width: 157px;
    overflow: visible;
}

.make-time {
    display: inline-block;
    font-size: 6.5px;
    color: #000;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    width: 70px;
    overflow: visible;
}

.tip {
    display: inline-block;
    font-size: 6.5px;
    color: #000;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
    overflow: visible;
    width: 82px;
}

.qrcode-placeholder {
    display: none;
    width: 0;
    height: 0;
}

.qr-number {
    display: none;
    font-size: 7px;
    color: #343944;
    font-weight: 500;
    white-space: nowrap;
}

.icons {
    display: none;
    font-size: 7px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    body {
        padding: 14px;
    }
}

@media (max-width: 380px) {
    .labels-waterfall {
        --label-gap: 8px;
        grid-template-columns: repeat(2, var(--label-width));
    }

    .label-card-shell {
        text-align: left;
    }
}
