*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    background: #ffffff;
    padding: 36px 32px;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    font-size: 26px;
    margin: 0 0 8px;
    color: #2c3e50;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 15px;
    color: #7f8c8d;
    margin: 0 0 28px;
    font-weight: 500;
}

/* ---- 拖放区 ---- */
.drop-zone-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 24px;
    width: 100%;
}

.drop-zone {
    width: 280px;
    height: 200px;
    border: 2px dashed #bbb;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.drop-zone.drag-over {
    border-color: #3498db;
    background: #e8f4fd;
}

.drop-zone.has-image {
    border-style: solid;
    border-color: #27ae60;
}

.drop-zone .icon {
    font-size: 40px;
    color: #aaa;
    margin-bottom: 8px;
    pointer-events: none;
}

.drop-zone .label {
    font-size: 14px;
    color: #999;
    pointer-events: none;
}

.drop-zone img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 2;
    padding: 0;
}

.drop-zone.has-image .remove-btn { display: flex; }

.remove-btn:hover { background: rgba(200, 40, 40, 0.85); }

/* ---- 操作按钮 ---- */
.action-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.action-bar button {
    padding: 10px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}

.action-bar button:active { transform: scale(0.97); }

.btn-primary {
    background: #3498db;
    color: #fff;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

.btn-primary:hover { background: #2980b9; }

.btn-primary:disabled {
    background: #b0c4de;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: #e0e0e0;
    color: #555;
}

.btn-secondary:hover { background: #ccc; }

/* ---- 错误消息 ---- */
.error-msg {
    background: #fff0f0;
    color: #c0392b;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 10px 18px;
    margin-bottom: 16px;
    font-size: 14px;
    display: none;
    max-width: 580px;
    text-align: center;
}

.error-msg.visible { display: block; }

/* ---- 结果区 ---- */
.result-section {
    display: none;
    width: 100%;
}

.result-section.visible { display: block; }

.result-section h2 {
    text-align: center;
    font-size: 18px;
    margin: 0 0 6px;
    color: #2c3e50;
    font-weight: 600;
}

.result-hint {
    text-align: center;
    font-size: 14px;
    color: #e67e22;
    font-weight: 500;
    margin: 0 0 16px;
}

.result-grid {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.result-card {
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 16px;
    flex: 1 1 300px;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-card .card-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
    align-self: flex-start;
}

.result-card .card-label span { color: #999; font-weight: 400; }

.result-card canvas {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    display: block;
}

.download-btn {
    margin-top: 12px;
    padding: 8px 22px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.download-btn:hover { background: #219a52; }
