@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-blur: 20px;
    --accent: #f59e0b;
    /* Using warning/amber color to distinguish from word counter's blue/indigo */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 40px 20px;
    position: relative;
    overflow-x: hidden;
    width: 100%;
}

/* Background Blobs */
.bg-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--primary-gradient);
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.12;
}

.blob-1 {
    top: -10%;
    right: -10%;
}

.blob-2 {
    bottom: -10%;
    left: -10%;
    animation-delay: -5s;
}

/* Calculator Card */
.calculator-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 30px 40px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

header p {
    color: #94a3b8;
    font-size: 1rem;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Top Bar Stats */
.top-bar {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.stat-item strong {
    color: var(--text-color);
    font-weight: 600;
    margin-left: 5px;
}

.separator {
    color: rgba(255, 255, 255, 0.2);
}

/* Text Area */
textarea {
    width: 100%;
    min-height: 250px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
}

textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

textarea::placeholder {
    color: #475569;
}

textarea::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Action Buttons */
.action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: #cbd5e1;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex-grow: 1;
    text-align: center;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
}

.action-btn:active {
    transform: translateY(0);
}

.utility-btn {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.utility-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    color: #7dd3fc;
}

.danger-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.danger-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Responsive */
@media (max-width: 768px) {
    .calculator-card {
        padding: 25px 15px;
    }

    .top-bar {
        font-size: 0.85rem;
        gap: 8px;
        padding: 10px;
    }

    .separator {
        display: none;
    }

    .stat-item {
        background: rgba(0, 0, 0, 0.2);
        padding: 4px 8px;
        border-radius: 6px;
    }

    .action-btn {
        flex-grow: 1;
        width: calc(50% - 5px);
        /* Two columns on mobile */
    }

    #btn-clear {
        width: 100%;
    }
}