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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

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

header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

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

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: white;
    color: #667eea;
    font-weight: 600;
}

.tab:hover:not(.active) {
    background: rgba(255,255,255,0.3);
}

.tab-content {
    display: none;
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.tab-content.active {
    display: block;
}

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

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

.input-row {
    display: flex;
    gap: 10px;
}

input[type="url"],
input[type="text"] {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
    width: 100%;
}

.input-group input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}

input[type="url"]:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn.primary:hover {
    background: #5a6fd6;
}

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

.btn.success:hover {
    background: #218838;
}

.btn.secondary {
    background: #6c757d;
    color: white;
}

.btn.secondary:hover {
    background: #5a6268;
}

.preview-box {
    margin-top: 25px;
    padding: 20px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    background: #fafafa;
}

.preview-box h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.article-preview {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: white;
    border-radius: 8px;
    line-height: 1.8;
}

.article-preview img {
    max-width: 100%;
    height: auto;
    margin: 10px 0;
    border-radius: 8px;
}

.output-preview {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: white;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.8;
}

.output-preview img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
    border-radius: 4px;
}

.output-preview h1 {
    font-size: 22px;
    font-weight: bold;
    margin: 20px 0 15px;
    line-height: 1.4;
}

.output-preview h2 {
    font-size: 18px;
    font-weight: bold;
    margin: 18px 0 12px;
    line-height: 1.4;
}

.output-preview p {
    margin: 12px 0;
    text-align: justify;
}

.output-preview blockquote {
    border-left: 4px solid #667eea;
    padding: 10px 15px;
    margin: 15px 0;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.upload-zone {
    border: 3px dashed #d0d0d0;
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: #667eea;
    background: #f0f3ff;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-zone p {
    color: #666;
    font-size: 1.1rem;
}

.style-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.style-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.style-btn.active {
    border-color: #667eea;
    background: #f0f3ff;
    color: #667eea;
    font-weight: 600;
}

.style-btn:hover:not(.active) {
    border-color: #999;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.error {
    padding: 15px 20px;
    background: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 10px;
    color: #d32f2f;
    margin-top: 15px;
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.phone-frame {
    position: relative;
    width: 375px;
    height: 667px;
    background: white;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.phone-header {
    background: #f8f8f8;
    padding: 50px 20px 15px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    position: relative;
}

.close-btn {
    position: absolute;
    right: 15px;
    top: 45px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.phone-content {
    height: calc(100% - 90px);
    overflow-y: auto;
    padding: 20px;
    font-size: 16px;
    line-height: 1.8;
}

.phone-content img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    body {
        padding: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-content {
        padding: 20px;
    }

    .input-row {
        flex-direction: column;
    }

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

    .btn {
        width: 100%;
    }

    .style-options {
        flex-direction: column;
    }
}

/* New styles for Toutiao feature */
.info-box {
    background: #e8f4fd;
    border: 1px solid #b3d9f2;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.8;
}

.info-box ol {
    margin: 10px 0 0 20px;
}

.info-box a {
    color: #667eea;
    text-decoration: none;
}

.info-box a:hover {
    text-decoration: underline;
}

textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: monospace;
    resize: vertical;
    min-height: 80px;
}

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

.success-text {
    color: #28a745;
    font-weight: 600;
}

.article-preview[contenteditable="true"] {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    cursor: text;
}

.article-preview[contenteditable="true"]:focus {
    outline: none;
    border-color: #667eea;
}

#login-status {
    margin-top: 15px;
    padding: 10px 15px;
    background: #d4edda;
    border-radius: 8px;
    text-align: center;
}

/* Login methods */
.login-methods {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-large {
    padding: 18px 30px;
    font-size: 1.1rem;
}

.divider {
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Source tabs */
.source-tabs {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.source-tab {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
}

.source-tab.active {
    border-color: #667eea;
    background: #f0f3ff;
    color: #667eea;
    font-weight: 600;
}

.source-content {
    display: none;
    margin-top: 20px;
}

.source-content.active {
    display: block;
}

.help-text {
    font-size: 13px;
    color: #888;
    margin-top: 8px;
}

/* Login modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
    text-align: center;
}

.modal-body p {
    margin: 10px 0;
    color: #666;
    line-height: 1.6;
}

#login-done-btn {
    margin-top: 20px;
    width: 100%;
}

/* Step boxes */
.step-box {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 20px;
}

.step-number {
    width: 36px;
    height: 36px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

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

.step-content p {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* Help details */
.help-details {
    margin: 10px 0;
    padding: 12px 15px;
    background: #fff3cd;
    border-radius: 8px;
    font-size: 13px;
}

.help-details summary {
    cursor: pointer;
    color: #856404;
    font-weight: 500;
}

.help-details ol {
    margin: 10px 0 0 20px;
    color: #666;
    line-height: 1.8;
}

.help-details a {
    color: #667eea;
}

/* Tip box */
.tip-box {
    margin-top: 20px;
    padding: 15px 20px;
    background: #e8f5e9;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.8;
}

.tip-box ol {
    margin: 10px 0 0 20px;
    color: #555;
}

.tip-box p {
    margin: 0;
    color: #2e7d32;
}
