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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --bg: #fafbff;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    padding: 48px 0 40px;
    text-align: center;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 8px;
}

.subtitle em {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Tool Section */
.tool-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 32px;
    margin-top: -24px;
    position: relative;
    z-index: 1;
}

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

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

textarea {
    width: 100%;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.7;
    resize: vertical;
    transition: border-color 0.2s;
    background: #f8fafc;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.style-selector label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.style-options {
    display: flex;
    gap: 4px;
}

.style-btn {
    padding: 8px 16px;
    border: 2px solid var(--border);
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.style-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.style-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.primary-btn {
    padding: 12px 28px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.primary-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

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

.secondary-btn {
    padding: 8px 16px;
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.secondary-btn:hover {
    background: #e2e8f0;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 0;
}

.text-btn:hover {
    text-decoration: underline;
}

/* Output */
.output-section {
    margin-top: 24px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
}

.output-section.visible {
    opacity: 1;
    transform: translateY(0);
}

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

.output-header h2 {
    font-size: 1.1rem;
    color: var(--success);
}

.output-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    font-size: 1rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.diff-toggle {
    margin-top: 12px;
}

.diff-section {
    margin-top: 12px;
    padding: 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
}

.diff-section h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #92400e;
}

.diff-section ul {
    list-style: none;
    padding: 0;
}

.diff-section li {
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid #fde68a;
}

.diff-section li:last-child {
    border-bottom: none;
}

/* How It Works */
.how-it-works {
    margin: 48px 0;
}

.how-it-works h2, .rules-section h2, .cta-section h2, .about-section h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    text-align: center;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.step {
    text-align: center;
    padding: 24px 16px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 auto 12px;
}

.step h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.step p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Rules */
.rules-section {
    margin: 48px 0;
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}

.rules-list {
    list-style: none;
    columns: 2;
    column-gap: 32px;
}

.rules-list li {
    padding: 8px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
    break-inside: avoid;
}

.rules-list li strong {
    color: var(--primary);
}

/* CTA */
.cta-section {
    background: linear-gradient(135deg, #eef2ff 0%, #faf5ff 100%);
    border-radius: var(--radius);
    padding: 40px 32px;
    text-align: center;
    margin: 48px 0;
    box-shadow: var(--shadow-lg);
}

.cta-section p {
    max-width: 600px;
    margin: 0 auto 20px;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.cta-features {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-bottom: 24px;
}

.cta-feature {
    font-size: 0.9rem;
    font-weight: 500;
}

.cta-btn {
    display: inline-block;
    text-decoration: none;
    padding: 14px 32px;
    font-size: 1.05rem;
}

.cta-email {
    margin-top: 16px;
    font-size: 0.9rem !important;
}

/* About */
.about-section {
    margin: 48px 0;
    text-align: center;
    padding: 24px;
}

.about-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.about-section a {
    color: var(--primary);
}

/* Footer */
footer {
    background: var(--text);
    color: #94a3b8;
    text-align: center;
    padding: 24px;
    margin-top: 48px;
    font-size: 0.85rem;
}

footer a {
    color: white;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Utility */
.hidden { display: none !important; }

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading spinner */
#humanizeBtn.loading {
    pointer-events: none;
    opacity: 0.7;
}

#humanizeBtn.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    margin-left: 8px;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

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

/* Responsive */
@media (max-width: 768px) {
    .steps { grid-template-columns: 1fr; }
    .rules-list { columns: 1; }
    .controls { flex-direction: column; align-items: stretch; }
    .style-options { justify-content: center; }
    .header h1 { font-size: 1.6rem; }
    .header { padding: 32px 0 28px; }
}
