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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: #333;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0;
    background: white;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    position: relative;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    height: 100%;
    width: 100%;
}

.header-center {
    flex: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 0;
}

.header-title-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.header-center h1 {
    margin-bottom: 5px;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}

.header-center .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    color: white;
    margin: 0;
}


/* 页眉右上角用户信息 */
.user-info-header {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user-info-header .points {
    font-size: 0.95rem;
    color: #333;
}

.user-info-header .points strong {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 700;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
    color: white;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    color: white;
}

.main-content {
    padding: 20px;
    position: relative;
    min-height: calc(100vh - 200px);
}


/* 内容布局 */
.content-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    min-height: calc(100vh - 200px);
    max-height: calc(100vh - 200px);
    overflow: hidden;
}

.input-section {
    flex: 0 0 450px;
    max-width: 450px;
    display: flex;
    flex-direction: column;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.input-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
    min-height: 400px;
    line-height: 1.6;
}

.input-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.config-group {
    margin-bottom: 25px;
}

.config-item {
    display: flex;
    flex-direction: column;
}

.config-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.config-item input,
.config-item select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s;
    background-color: white;
    cursor: pointer;
}

.config-item input:focus,
.config-item select:focus {
    outline: none;
    border-color: #667eea;
}

.config-item select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.generate-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.generate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loader {
    display: inline-block;
}

.result-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.image-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    overflow: visible;
    position: relative;
}

.image-placeholder {
    color: #999;
    font-size: 1rem;
}

.image-container img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    object-fit: contain;
}

.image-container .loading {
    color: #667eea;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 20px;
    position: relative;
    z-index: 1;
    white-space: nowrap;
    display: block;
    min-height: 50px;
    line-height: 1.5;
}

.image-container .error-display {
    color: #c33;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 30px;
    text-align: center;
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 10px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
    word-wrap: break-word;
    max-width: 100%;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

.download-btn,
.regenerate-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.download-btn {
    background: #28a745;
    color: white;
}

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

.regenerate-btn {
    background: #667eea;
    color: white;
}

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

.error-section {
    margin-top: 20px;
    padding: 20px;
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 10px;
    position: relative;
    z-index: 1;
}

.error-message {
    color: #c33;
    font-weight: 500;
}

@media (max-width: 768px) {
    .config-group {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2rem;
    }

    .main-content {
        padding: 30px 20px;
    }

    .action-buttons {
        flex-direction: column;
    }
}

/* 用户信息样式 */
.user-info {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.username {
    font-size: 1rem;
    font-weight: 600;
}

.points {
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
}

.points strong {
    color: #ffd700;
    font-size: 1.1rem;
}

.redeem-btn,
.logout-btn {
    padding: 8px 16px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.redeem-btn:hover,
.logout-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
}

.logout-btn {
    background: #dc3545;
}

.logout-btn:hover {
    background: #c82333;
}

/* 登录/注册界面 */
.auth-section {
    padding: 40px 30px;
    max-width: 400px;
    margin: 0 auto;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.tab-btn:hover {
    color: #667eea;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.auth-btn:active {
    transform: translateY(0);
}

.auth-error {
    color: #e74c3c;
    font-size: 0.9rem;
    padding: 10px;
    background: #fee;
    border-radius: 5px;
    display: none;
}

.points-info {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin: 15px 0;
}

.points-info strong {
    color: #667eea;
    font-size: 1rem;
}

.quality-info {
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    margin: 10px 0 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

/* 兑换码弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 15px;
    color: #333;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.modal-content input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.modal-content input:focus {
    outline: none;
    border-color: #667eea;
}

/* 二维码放大弹窗样式 */
.qr-code-modal {
    max-width: 500px;
    text-align: center;
}

.qr-code-large {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.qr-code-large img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #000;
}

/* 二维码客服区域（页眉） */
.qr-code-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 140px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.qr-code-header .qr-code-text {
    font-size: 0.7rem;
    color: #333;
    text-align: center;
    line-height: 1.3;
    font-weight: 500;
}

.qr-code-header .qr-code-image {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.qr-code-header .qr-code-image:hover {
    transform: scale(1.05);
}

.qr-code-header .qr-code-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .user-info {
        flex-direction: column;
        gap: 10px;
    }

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

    .header-center {
        text-align: center;
    }

    .user-info-header {
        width: 100%;
        justify-content: center;
    }

    .content-layout {
        flex-direction: column;
        margin-top: 20px;
        height: auto;
    }

    .input-section {
        flex: 1;
        max-width: 100%;
        width: 100%;
    }

    .image-container {
        min-height: 300px;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
    }

    .header-left {
        text-align: center;
    }

    .qr-code-header {
        min-width: auto;
        width: 100%;
        max-width: 160px;
    }

    .qr-code-header .qr-code-image {
        width: 80px;
        height: 80px;
    }

    .auth-section {
        padding: 30px 20px;
    }

    .modal-content {
        margin: 20% auto;
        padding: 20px;
    }
}