:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --pill-bg: rgba(22, 27, 34, 0.85);
    --pill-border: rgba(48, 54, 61, 0.5);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden; /* Prevent body scroll, textarea will scroll */
}

/* Background gradient effect */
body::before {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(88, 166, 255, 0.15) 0%, rgba(13, 17, 23, 0) 70%);
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
}

/* Top Pill - App Name */
.header-pill {
    margin-top: 2rem;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    animation: fadeInDown 0.5s ease-out;
}

.header-pill h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(90deg, #fff, #a5d6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Main Content - Text Area */
.main-container {
    flex: 1;
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

textarea {
    width: 100%;
    height: 100%;
    background-color: transparent; /* Transparent to blend */
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1.6;
    padding: 1rem;
    resize: none;
    outline: none;
    font-family: inherit;
}

textarea::placeholder {
    color: var(--text-secondary);
}

/* Bottom Pill - Stats */
.stats-pill {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 1rem 2rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    gap: 2rem;
    width: 90%;
    max-width: 900px;
    justify-content: space-around;
    flex-wrap: wrap;
    z-index: 10;
    transition: transform 0.3s ease, opacity 0.3s ease;
    animation: fadeInUp 0.5s ease-out 0.2s backwards;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-width: 60px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Special styling for word frequency tooltip/logic if needed, 
   but for now we put frequent/rare in the pill too */
.freq-container {
    display: flex;
    gap: 2rem;
    border-left: 1px solid var(--pill-border);
    padding-left: 2rem;
}

/* Brand Pill - Top Right */
.brand-pill {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    z-index: 20;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    animation: fadeInDown 0.5s ease-out;
    transition: color 0.2s, border-color 0.2s;
}

.brand-pill:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

@media (max-width: 768px) {
    .stats-pill {
        bottom: 1rem;
        padding: 1rem;
        gap: 1rem;
        border-radius: 16px;
        justify-content: center;
        width: 95%;
    }
    
    .freq-container {
        border-left: none;
        padding-left: 0;
        width: 100%;
        justify-content: space-around;
        border-top: 1px solid var(--pill-border);
        padding-top: 1rem;
    }
    
    .header-pill {
        margin-top: 1rem;
        padding: 0.8rem 1.5rem;
    }
    
    .header-pill h1 {
        font-size: 1.2rem;
    }

    .brand-pill {
        top: 1rem;
        right: 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #4a525d;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
