* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.title i {
    margin-right: 10px;
    color: #ffd700;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 40px;
    margin-bottom: 30px;
}

.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e8f2ff;
    transform: scale(1.02);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    font-size: 4rem;
    color: #667eea;
}

.upload-content h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 5px;
}

.upload-content p {
    color: #666;
    font-size: 1rem;
}

.supported-formats {
    font-size: 0.9rem;
    color: #888;
}

.select-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.processing-section {
    text-align: center;
    padding: 40px;
}

.processing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.progress-bar {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.result-section {
    text-align: center;
}

.image-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.image-box {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.image-box h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.image-box img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-download {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-new {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
    color: white;
}

.btn-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.4);
}

.error-section {
    text-align: center;
    padding: 40px;
}

.error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.error-icon {
    font-size: 3rem;
    color: #dc3545;
}

.error-content h3 {
    color: #dc3545;
    font-size: 1.5rem;
}

.error-content p {
    color: #666;
    max-width: 400px;
}

.btn-retry {
    background: linear-gradient(135deg, #fd7e14 0%, #e83e8c 100%);
    color: white;
}

.btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(253, 126, 20, 0.4);
}

.footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .image-comparison {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .upload-area {
        padding: 40px 15px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}
/* ── 登录/用户 UI ── */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.header-title { flex: 1; }
.header-user { flex-shrink: 0; }

.btn-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: white;
    color: #667eea;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
}
.user-avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid white; }
.user-name { color: white; font-weight: 500; font-size: 0.9rem; }
.usage-badge {
    background: rgba(255,255,255,0.9);
    color: #667eea;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.usage-badge.badge-empty { background: #ff6b6b; color: white; }
.btn-logout {
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); color: white; }

/* ── 使用次数提示条 ── */
.usage-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #e8f4fd;
    border: 1px solid #bee3f8;
    color: #2b6cb0;
    padding: 10px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.usage-bar.usage-bar-empty {
    background: #fff5f5;
    border-color: #fed7d7;
    color: #c53030;
}

/* ── 历史记录 ── */
.history-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}
.history-section h3 {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 16px;
}
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}
.history-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #f8f8f8;
    border: 1px solid #eee;
    aspect-ratio: 1;
}
.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.history-time {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 0.7rem;
    padding: 4px 6px;
    text-align: center;
}
.history-download {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255,255,255,0.9);
    color: #667eea;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.history-item:hover .history-download { opacity: 1; }

/* ── 升级弹窗 ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal h2 { font-size: 1.6rem; margin-bottom: 12px; }
.modal p { color: #666; margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-upgrade {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s;
}
.btn-upgrade:hover { transform: translateY(-2px); }
.btn-close-modal {
    background: #f0f0f0;
    color: #666;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-close-modal:hover { background: #e0e0e0; }

/* ── 登录引导横幅 ─────────────────────────────────────── */
.login-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.login-banner-content {
  display: flex;
  align-items: center;
  gap: 14px;
}
.login-banner-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.login-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #fff;
}
.login-banner-text strong {
  font-size: 1rem;
  font-weight: 700;
}
.login-banner-text span {
  font-size: 0.85rem;
  opacity: 0.88;
}
.login-banner-btn {
  background: #fff;
  color: #764ba2;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.login-banner-btn:hover { opacity: 0.85; }

/* ── 用户中心按钮 ─────────────────────────────────────── */
.btn-dashboard {
  background: rgba(102,126,234,0.18);
  color: #a78bfa;
  border: 1px solid rgba(102,126,234,0.35);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.82rem;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-dashboard:hover { background: rgba(102,126,234,0.32); }

/* ── Dashboard 布局 ───────────────────────────────────── */
.dashboard-wrap {
  min-height: 100vh;
  background: #0f0f1a;
  color: #e2e8f0;
}
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.dash-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #a78bfa;
  text-decoration: none;
}
.dash-logo i { margin-right: 8px; }
.dash-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Dashboard 卡片 ───────────────────────────────────── */
.dash-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 16px;
  padding: 28px;
}
.dash-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #a78bfa;
  margin: 0 0 20px;
}
.dash-card h3 i { margin-right: 8px; }

/* 用户信息卡片 */
.user-card {
  display: flex;
  align-items: center;
  gap: 24px;
}
.user-card-avatar img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #764ba2;
}
.user-card-info h2 { margin: 0 0 4px; font-size: 1.3rem; }
.dash-email { color: #94a3b8; font-size: 0.9rem; margin: 0 0 10px; }
.plan-badge {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-radius: 20px;
  padding: 3px 14px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* 使用情况 */
.usage-stats { display: flex; flex-direction: column; gap: 12px; }
.usage-numbers { font-size: 2.5rem; font-weight: 700; color: #fff; }
.usage-numbers span { font-size: 2.5rem; }
.usage-sep { color: #475569; margin: 0 6px; }
.usage-unit { font-size: 1rem; color: #94a3b8; margin-left: 6px; }
.usage-progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.usage-progress-bar {
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
}
.usage-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 99px;
  transition: width 0.6s ease;
}
.usage-progress-text { font-size: 0.85rem; color: #94a3b8; }

/* 套餐卡片 */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.plan-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.plan-recommended {
  border-color: #764ba2;
  background: rgba(118,75,162,0.12);
}
.plan-tag {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: 99px;
  white-space: nowrap;
}
.plan-name { font-weight: 700; font-size: 1rem; color: #e2e8f0; }
.plan-price { font-size: 1.6rem; font-weight: 800; color: #fff; }
.plan-price span { font-size: 0.85rem; color: #94a3b8; font-weight: 400; }
.plan-quota { font-size: 0.85rem; color: #a78bfa; font-weight: 600; }
.plan-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.plan-features li { font-size: 0.82rem; color: #94a3b8; }
.plan-features li i { color: #667eea; margin-right: 6px; }
.btn-plan {
  margin-top: auto;
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 9px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-plan:hover { background: rgba(255,255,255,0.14); }
.btn-plan-primary {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: transparent;
  color: #fff;
}
.btn-plan-primary:hover { opacity: 0.88; background: linear-gradient(135deg, #667eea, #764ba2); }

/* 购买记录 */
.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.orders-table th {
  text-align: left;
  padding: 10px 12px;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.orders-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.order-status {
  background: rgba(102,126,234,0.2);
  color: #a78bfa;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.78rem;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 32px;
  color: #475569;
}
.empty-state i { font-size: 2rem; margin-bottom: 10px; display: block; }
.empty-state p { margin: 0; font-size: 0.9rem; }
