/* ═══════════════════════════════════════════════
   THREAD FORGE
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-page: hsl(40, 30%, 97%);
    --bg-card: hsl(0, 0%, 100%);
    --border: hsl(30, 15%, 88%);
    --border-hover: hsl(30, 20%, 78%);
    --text-0: hsl(220, 20%, 16%);
    --text-1: hsl(220, 10%, 38%);
    --text-2: hsl(220, 8%, 55%);
    --text-3: hsl(220, 6%, 68%);
    --accent: hsl(245, 58%, 56%);
    --accent-light: hsl(245, 58%, 64%);
    --accent-bg: hsl(245, 60%, 96%);
    --sans: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --radius: 10px;
    --radius-lg: 16px;
    --transition: 200ms ease;
    --shadow-sm: 0 1px 3px hsla(220, 20%, 16%, 0.06);
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--sans);
    background: var(--bg-page);
    color: var(--text-0);
    min-height: 100vh;
}

.tf-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 32px 60px;
}

.tf-hero {
    text-align: center;
    margin-bottom: 28px;
}

.tf-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: var(--accent-bg);
    border: 1px solid hsl(245, 50%, 88%);
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 12px;
}

.tf-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.tf-subtitle {
    font-size: 1rem;
    color: var(--text-2);
}

/* ─── Workspace ─── */
.tf-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* ─── Input ─── */
.tf-input-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tf-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tf-input-header label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
}

.tf-charcount {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-3);
}

.tf-textarea {
    width: 100%;
    height: 280px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-page);
    font-family: var(--sans);
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-0);
    resize: vertical;
    transition: border-color var(--transition);
}

.tf-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.tf-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tf-option-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tf-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tf-option label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-3);
}

.tf-option select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-page);
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--text-0);
}

.tf-option select:focus {
    outline: none;
    border-color: var(--accent);
}

.tf-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.tf-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    color: var(--text-1);
    cursor: pointer;
}

.tf-check input {
    accent-color: var(--accent);
    cursor: pointer;
}

.tf-forge-btn {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: white;
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 8px hsla(245, 58%, 56%, 0.25);
}

.tf-forge-btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

/* ─── Output ─── */
.tf-output-panel {
    position: sticky;
    top: 20px;
}

.tf-empty {
    text-align: center;
    color: var(--text-3);
    padding: 80px 20px;
}

.tf-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.tf-empty p {
    font-size: 0.88rem;
}

/* Tweets */
.tf-thread {
    display: flex;
    flex-direction: column;
}

.tf-thread-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
    }
}

.tf-tweet {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.tf-tweet:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
}

.tf-tweet-hook {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.tf-tweet-hook:hover {
    border-color: var(--accent-light);
}

.tf-tweet-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tf-tweet-num {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: hsl(220, 15%, 93%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-2);
}

.tf-tweet-hook .tf-tweet-num {
    background: var(--accent);
    color: white;
}

.tf-tweet-chars {
    font-family: var(--mono);
    font-size: 0.62rem;
    color: var(--text-3);
    margin-left: auto;
}

.tf-tweet-chars.tf-over {
    color: hsl(0, 65%, 55%);
    font-weight: 600;
}

.tf-tweet-copy {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.4;
    transition: opacity var(--transition);
}

.tf-tweet-copy:hover {
    opacity: 1;
}

.tf-tweet-body {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-0);
    outline: none;
    min-height: 1.5em;
}

.tf-tweet-body:focus {
    background: hsl(245, 60%, 98%);
    border-radius: 4px;
    padding: 4px;
    margin: -4px;
}

.tf-tweet-warn {
    font-size: 0.68rem;
    color: hsl(0, 65%, 55%);
    margin-top: 6px;
    font-weight: 500;
}

.tf-connector {
    width: 2px;
    height: 16px;
    background: var(--border);
    margin: 0 auto;
}

/* Actions */
.tf-thread-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.tf-action-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    font-family: var(--sans);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-1);
    cursor: pointer;
    transition: all var(--transition);
}

.tf-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tf-tweet-count {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-3);
    margin-left: auto;
}

/* CTA */
.tf-cta-bar {
    text-align: center;
    margin-top: 32px;
    padding: 16px;
    font-size: 0.82rem;
    color: var(--text-2);
}

.tf-cta-bar a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.tf-cta-bar a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .tf-workspace {
        grid-template-columns: 1fr;
    }

    .tf-output-panel {
        position: static;
    }

    .tf-main {
        padding: 24px 16px 40px;
    }

    .tf-hero h1 {
        font-size: 1.7rem;
    }
}