* {
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    margin: 0;
    padding: 0 0 60px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100dvh;
}
.container {
    max-width: 500px;
    width: 90%;
    background: white;
    padding: 2.5rem 2rem;
    border-radius: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin: auto;
}
h1 {
    font-size: clamp(1.4rem, 3.5vw, 1.8rem);
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.alert {
    background: #fff2cc;
    border: 1px solid #ffd61a;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    color: #1d1d1f;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
}
form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: flex-start;
    margin-bottom: 12px;
}
.upload-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #d2d2d7;
    border-radius: 12px;
    background: #f5f5f7;
    padding: clamp(1rem, 4vw, 2rem);
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}
.upload-area:hover,
.upload-area.dragover {
    border-color: #007aff;
    background: #e8f4fd;
    transform: scale(1.02);
}

.upload-area.dragover {
    border-color: #0056b3;
    background: #cce7ff;
}

.upload-area {
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.upload-icon {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    color: #007aff;
    margin-bottom: 1rem;
}
.upload-label {
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 0.5rem;
}
.upload-hint {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #6e6e73;
}
.selected-file {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #007aff;
    margin-top: 0.5rem;
    word-break: break-all;
}

.export-mode-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.export-mode-label {
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    font-weight: 500;
    color: #1d1d1f;
}

.export-mode-dropdown {
    width: 100%;
    max-width: 200px;
    padding: 0.5rem;
    border: 1px solid #e5e5e7;
    border-radius: 8px;
    background-color: #ffffff;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    color: #1d1d1f;
    outline: none;
    transition: border-color 0.2s ease;
}

.export-mode-dropdown:focus {
    border-color: #007aff;
}

.year-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.year-label {
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    font-weight: 500;
    color: #1d1d1f;
}

.year-dropdown {
    width: 100%;
    max-width: 200px;
    padding: clamp(0.3rem, 1vw, 0.4rem);
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    background: white;
    color: #1d1d1f;
    cursor: pointer;
    transition: border-color 0.2s;
}

.year-dropdown:hover {
    border-color: #007aff;
}

.year-dropdown:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.alert.error {
    background: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.alert.error.fade-out {
    opacity: 0;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #6e6e73;
    margin-top: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.loading-text.fade-out {
    opacity: 0;
}

.error-message {
    background: #ffebee;
    border: 1px solid #f44336;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
    color: #c62828;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 1;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.error-message.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.success-message {
    background: #e8f5e8;
    border: 1px solid #4caf50;
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 1rem;
    color: #2e7d32;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 1;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.success-message.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

button:disabled {
    background: #d2d2d7;
    cursor: not-allowed;
    transform: none;
}

button:disabled:hover {
    background: #d2d2d7;
}

.loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #6e6e73;
    margin-top: 1rem;
}

input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: -1; /* 确保 file input 在 upload-area 之下 */
}

.upload-area {
    position: relative; /* 确保 upload-area 有定位上下文 */
}
button {
    background: #007aff;
    color: white;
    border: none;
    padding: clamp(0.75rem, 2.5vw, 1rem) clamp(1.25rem, 4vw, 2rem);
    border-radius: 12px;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
button:hover {
    background: #0056cc;
}
button:active {
    transform: scale(0.98);
}
.info-section {
    padding-top: 1rem;
    margin-top: 1rem;
}
.info-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}
.info-section li {
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    color: #86868b;
    line-height: 1.3;
    margin-bottom: 0.3rem;
    padding-left: 1.2rem;
    position: relative;
}
.info-section li::before {
    content: "•";
    color: #007aff;
    position: absolute;
    left: 0;
    font-weight: bold;
}
hr {
    border: none;
    height: 1px;
    background: #d2d2d7;
    margin: 0.5rem 0;
    flex-shrink: 0;
}
/* Responsive Design - Maintain card on all sizes */
@media (max-width: 1024px) {
    body {
        padding: 1rem 1rem 60px 1rem;
    }
    .container {
        max-width: 450px;
        padding: 2rem 1.5rem;
        height: auto;
    }
    h1 {
        font-size: clamp(1.5rem, 2.5vw, 1.7rem);
        margin-bottom: 1rem;
    }
    form {
        gap: 1rem;
    }
    .info-section {
        padding-top: 0.5rem;
        margin-top: 0.5rem;
    }
    .info-section li {
        margin-bottom: 0.3rem;
    }
    hr {
        margin: 0.5rem 0;
    }
}

@media (max-width: 768px) {
    .container {
        width: 90%;
        max-width: 450px;
        padding: 1.5rem 1.5rem;
        border-radius: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        height: auto;
        justify-content: flex-start;
        overflow-y: auto;
        margin: 1rem auto;
    }
    h1 {
        font-size: clamp(1.3rem, 4vw, 1.6rem);
        margin-bottom: 1rem;
    }
    form {
        gap: 1rem;
        justify-content: flex-start;
    }
    .upload-area {
        padding: clamp(0.8rem, 4vw, 1.5rem);
    }
    .upload-icon {
        font-size: clamp(1.6rem, 7vw, 2.2rem);
    }
    button {
        font-size: clamp(0.8rem, 3vw, 0.95rem);
        padding: clamp(0.6rem, 2.5vw, 0.9rem) clamp(1rem, 4vw, 1.5rem);
    }
    .info-section {
        padding-top: 0.5rem;
        margin-top: 0.5rem;
    }
    .info-section li {
        font-size: clamp(0.65rem, 2.5vw, 0.75rem);
        margin-bottom: 0.2rem;
        line-height: 1.2;
    }
    hr {
        margin: 0.3rem 0;
    }
}

@media (max-width: 480px) {
    .container {
        width: 95%;
        max-width: 400px;
        padding: 1.2rem 1rem;
        margin: 0.5rem auto;
        border-radius: 12px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
        height: auto;
    }
    h1 {
        font-size: clamp(1.1rem, 5vw, 1.4rem);
    }
    form {
        gap: 0.8rem;
    }
    .upload-area {
        padding: 0.6rem;
    }
    .upload-icon {
        font-size: clamp(1.4rem, 8vw, 1.8rem);
    }
    .info-section li {
        font-size: clamp(0.6rem, 3vw, 0.7rem);
        margin-bottom: 0.15rem;
        line-height: 1.15;
    }
    hr {
        margin: 0.2rem 0;
    }
}

.footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background-color: #f5f5f7;
    padding: 1rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: #1d1d1f;
    z-index: 1000;
    font-family: inherit;
}

.footer p {
    margin: 0;
    padding: 0 1rem;
}

.footer a {
    color: inherit;
    text-decoration: none;
    position: relative;
}

.footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 1px;
    background-color: #1d1d1f;
    transition: width 0.3s ease, left 0.3s ease;
}

.footer a:hover::after {
    width: 100%;
    left: 0;
}

@media (max-width: 768px) {
    .footer {
        font-size: 0.75rem;
        padding: 0.75rem 0;
    }

    .footer p {
        padding: 0 0.75rem;
    }
}

@media (max-width: 480px) {
    .footer {
        font-size: 0.7rem;
        padding: 0.5rem 0;
    }

    .footer p {
        padding: 0 0.5rem;
    }
}

/* 进度条样式 */
.progress-bar-container {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007aff, #0056cc);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: translateX(-100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.8rem;
    color: #6e6e73;
    margin-top: 0.5rem;
    display: block;
    text-align: center;
}

@media (max-width: 480px) {
    .progress-bar-container {
        max-width: 250px;
    }

    .progress-bar {
        height: 4px;
    }

    .progress-text {
        font-size: 0.7rem;
    }
}

/* Toast 消息样式 */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    align-items: center;
    width: auto;
    max-width: 90%;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
                0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: auto;
    min-width: 280px;
    max-width: 450px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: auto;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.hide {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
}

.toast.success {
    background: linear-gradient(135deg,
        rgba(232, 245, 232, 0.95),
        rgba(240, 249, 240, 0.95));
    border-color: rgba(76, 175, 80, 0.3);
    color: #2e7d32;
}

.toast.error {
    background: linear-gradient(135deg,
        rgba(255, 235, 238, 0.95),
        rgba(255, 241, 242, 0.95));
    border-color: rgba(244, 67, 54, 0.3);
    color: #c62828;
}

.toast.info {
    background: linear-gradient(135deg,
        rgba(227, 242, 253, 0.95),
        rgba(240, 248, 255, 0.95));
    border-color: rgba(33, 150, 243, 0.3);
    color: #1565c0;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    backdrop-filter: blur(8px);
}

.toast-message {
    flex: 1;
    word-break: break-word;
    font-weight: 500;
    min-width: 0;
}

.toast-close {
    background: rgba(255, 255, 255, 0.6);
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    pointer-events: auto;
    backdrop-filter: blur(8px);
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.05);
}

/* Toast 进度条 */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 14px 14px;
    transition: width linear;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .toast-container {
        max-width: 400px;
        min-width: 260px;
    }

    .toast {
        padding: 13px 16px;
        font-size: 14px;
        min-width: 260px;
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .toast-container {
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        max-width: 350px;
        min-width: 240px;
        width: calc(100% - 40px);
    }

    .toast {
        padding: 12px 15px;
        font-size: 13px;
        gap: 10px;
        min-width: 240px;
        max-width: 350px;
    }

    .toast-icon {
        font-size: 18px;
        width: 22px;
        height: 22px;
    }

    .toast-close {
        font-size: 16px;
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .toast-container {
        top: 10px;
        width: calc(100% - 20px);
        min-width: 200px;
        max-width: 300px;
        gap: 8px;
    }

    .toast {
        padding: 11px 14px;
        font-size: 13px;
        gap: 8px;
        min-width: 200px;
        max-width: 300px;
    }

    .toast-icon {
        font-size: 16px;
        width: 20px;
        height: 20px;
    }

    .toast-close {
        font-size: 14px;
        width: 20px;
        height: 20px;
    }

    .toast-progress {
        height: 2px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    .toast-container {
        top: 8px;
        width: calc(100% - 16px);
        min-width: 180px;
        max-width: none;
    }

    .toast {
        padding: 10px 12px;
        font-size: 12px;
        gap: 8px;
        min-width: 180px;
        max-width: none;
    }

    .toast-icon {
        font-size: 14px;
        width: 18px;
        height: 18px;
    }

    .toast-close {
        font-size: 12px;
        width: 18px;
        height: 18px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .toast {
        background: rgba(28, 28, 30, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .toast.success {
        background: linear-gradient(135deg,
            rgba(34, 51, 34, 0.95),
            rgba(40, 60, 40, 0.95));
        border-color: rgba(76, 175, 80, 0.3);
    }

    .toast.error {
        background: linear-gradient(135deg,
            rgba(51, 34, 34, 0.95),
            rgba(60, 40, 40, 0.95));
        border-color: rgba(244, 67, 54, 0.3);
    }

    .toast.info {
        background: linear-gradient(135deg,
            rgba(34, 47, 63, 0.95),
            rgba(40, 56, 75, 0.95));
        border-color: rgba(33, 150, 243, 0.3);
    }

    .toast-icon,
    .toast-close {
        background: rgba(255, 255, 255, 0.1);
    }

    .toast-close:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}
