@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #10b981;
    --accent-2: #06b6d4;
    --border: rgba(255, 255, 255, 0.1);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
}

/* ── Background Blobs ── */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.blob {
    position: absolute;
    width: 650px;
    height: 650px;
    background: var(--primary-gradient);
    filter: blur(140px);
    opacity: 0.12;
    border-radius: 50%;
    top: -150px;
    left: -150px;
    animation: blobFloat 12s ease-in-out infinite alternate;
}

.blob-2 {
    bottom: -150px;
    right: -150px;
    top: auto;
    left: auto;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    animation-delay: -6s;
}

@keyframes blobFloat {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(30px, 20px) scale(1.05);
    }
}

/* ── Container ── */
.tool-container {
    width: 100%;
    max-width: 860px;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 3rem;
    box-shadow: var(--shadow-premium);
    margin: 1rem auto;
}

/* ── Header ── */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header-icon {
    font-size: 2.8rem;
    font-weight: 800;
    font-family: 'Space Mono', monospace;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1;
    margin-bottom: 0.75rem;
    display: block;
}

.header h1 {
    font-size: 2.4rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

/* ── Mode Toggle ── */
.mode-toggle {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 2rem;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border-radius: 11px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.mode-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.mode-btn.active {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.mode-icon {
    font-size: 1rem;
}

/* ── Layout ── */
.encoder-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Cards ── */
.input-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}

.input-card:focus-within {
    border-color: var(--accent);
    background: rgba(16, 185, 129, 0.04);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.output-card {
    border-color: rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.03);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

textarea {
    width: 100%;
    height: 200px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    line-height: 1.65;
    min-height: 120px;
}

textarea::placeholder {
    color: rgba(148, 163, 184, 0.45);
}

/* ── Stats Bar ── */
.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.9rem 1.5rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: 14px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-val {
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-lbl {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

/* ── Buttons ── */
.action-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.action-link:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 1rem;
    border-radius: 9px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}

.copy-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.copy-btn.copied {
    background: #10b981;
    border-color: #10b981;
}

/* ── Info Section ── */
.info-section {
    margin-top: 2rem;
    padding: 1.5rem 2rem;
    background: rgba(16, 185, 129, 0.05);
    border-radius: 18px;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.info-section h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: #6ee7b7;
}

.info-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.info-section code {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'Space Mono', monospace;
    font-size: 0.85em;
    color: #a7f3d0;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    .tool-container {
        padding: 1.5rem 1.25rem;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .mode-toggle {
        width: 100%;
    }

    .mode-btn {
        flex: 1;
        justify-content: center;
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    .stats-bar {
        gap: 1rem;
        padding: 0.75rem 1rem;
    }

    .stat-divider {
        display: none;
    }
}