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

/* 确保 hidden 属性生效 */
[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #fff5f5 0%, #ffeef8 50%, #f5f0ff 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px;
    min-height: 100vh;
}

/* 顶部区域 */
.header {
    text-align: center;
    padding: 24px 0;
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: #ff6b9d;
    margin-bottom: 8px;
}

.slogan {
    font-size: 14px;
    color: #888;
}

/* 用户登录区域 */
.auth-section {
    margin-bottom: 20px;
}

.auth-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(255, 107, 157, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ff6b9d;
}

.user-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.user-email {
    font-size: 12px;
    color: #888;
}

.logout-btn {
    padding: 6px 12px;
    background: none;
    border: 1px solid #ff6b9d;
    border-radius: 6px;
    color: #ff6b9d;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #ff6b9d;
    color: white;
}

.login-prompt {
    text-align: center;
}

.login-prompt p {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
}

.google-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.google-login-btn:hover {
    border-color: #4285F4;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.2);
}

.google-icon {
    flex-shrink: 0;
}

/* API Key 输入区域 */
.api-section {
    margin-bottom: 20px;
}

.api-input-wrapper {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 12px rgba(255, 107, 157, 0.1);
}

.api-input-wrapper label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.api-input-wrapper input {
    width: 100%;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.api-input-wrapper input:focus {
    outline: none;
    border-color: #ff6b9d;
}

.api-input-wrapper small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 20px;
}

.upload-area {
    background: white;
    border: 2px dashed #ffb6c1;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #ff6b9d;
    background: #fff5f8;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 12px;
    color: #999;
}

/* 图片预览区 */
.preview-section {
    margin-top: 16px;
    display: none;
}

.preview-section.show {
    display: block;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.preview-count {
    font-size: 14px;
    color: #666;
}

.clear-btn {
    background: none;
    border: none;
    color: #ff6b9d;
    font-size: 14px;
    cursor: pointer;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 分析按钮 */
.action-section {
    text-align: center;
    margin-bottom: 24px;
}

.analyze-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #ff6b9d 0%, #ff8a80 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(255, 107, 157, 0.3);
}

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

.analyze-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
}

.analyze-btn .btn-loading {
    display: none;
    align-items: center;
    gap: 8px;
}

.analyze-btn .btn-loading:not([hidden]) {
    display: inline-flex;
}

.progress-text {
    font-size: 14px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.analyze-hint {
    margin-top: 12px;
    font-size: 13px;
    color: #999;
}

.usage-limit-hint {
    margin-top: 12px;
    font-size: 14px;
    color: #ff4757;
    font-weight: 500;
    padding: 10px 16px;
    background: #fff5f5;
    border-radius: 8px;
    border: 1px solid #ffcdd2;
}

/* 结果展示区域 */
.result-section {
    margin-bottom: 24px;
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(255, 107, 157, 0.15);
}

.result-title {
    font-size: 20px;
    font-weight: 600;
    color: #ff6b9d;
    margin-bottom: 16px;
    text-align: center;
}

.result-content {
    font-size: 15px;
    line-height: 1.8;
    color: #444;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-content h3 {
    color: #ff6b9d;
    font-size: 16px;
    margin: 16px 0 8px;
}

.result-content p {
    margin-bottom: 12px;
}

.retry-btn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: white;
    border: 2px solid #ff6b9d;
    border-radius: 10px;
    color: #ff6b9d;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: #ff6b9d;
    color: white;
}

/* 底部免责声明 */
.footer {
    text-align: center;
    padding: 20px 0;
}

.footer p {
    font-size: 12px;
    color: #999;
}

/* 响应式适配 */
@media (max-width: 375px) {
    .preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .title {
        font-size: 24px;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 40px 20px;
    }
    
    .header {
        padding: 40px 0;
    }
    
    .title {
        font-size: 32px;
    }
}
