[data-bs-theme="light"] {
    --wc-body-bg: #f4f6f9;
    --wc-card-bg: #ffffff;
    --wc-stat-bg: #ffffff;
    --wc-stat-border: rgba(0, 0, 0, 0.06);
    --wc-stat-value: #212529;
    --wc-stat-label: #6c757d;
    --wc-density-header-bg: #212529;
    --wc-density-header-color: #fff;
    --wc-accent-primary: #0d6efd;
    --wc-accent-success: #198754;
    --wc-accent-info: #0dcaf0;
    --wc-accent-warning: #fd7e14;
    --wc-bar-bg: #e9ecef;
    --wc-faq-bg: #ffffff;
    color-scheme: light;
}

[data-bs-theme="dark"] {
    --wc-body-bg: #0d1117;
    --wc-card-bg: #161b22;
    --wc-stat-bg: #161b22;
    --wc-stat-border: rgba(255, 255, 255, 0.08);
    --wc-stat-value: #e6edf3;
    --wc-stat-label: #8b949e;
    --wc-density-header-bg: #21262d;
    --wc-density-header-color: #e6edf3;
    --wc-accent-primary: #58a6ff;
    --wc-accent-success: #3fb950;
    --wc-accent-info: #39c5cf;
    --wc-accent-warning: #d29922;
    --wc-bar-bg: #30363d;
    --wc-faq-bg: #161b22;
    color-scheme: dark;
}

body {
    background-color: var(--wc-body-bg);
    min-height: 100vh;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.text-input {
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 10rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.section-label {
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Stat cards */
.stat-card {
    background: var(--wc-stat-bg);
    border: 1px solid var(--wc-stat-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1rem;
    text-align: center;
    height: 100%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--wc-accent-primary);
    opacity: 0.85;
}

.stat-card--primary::before { background: var(--wc-accent-primary); }
.stat-card--success::before { background: var(--wc-accent-success); }
.stat-card--info::before { background: var(--wc-accent-info); }
.stat-card--warning::before { background: var(--wc-accent-warning); }
.stat-card--secondary::before { background: var(--wc-stat-label); opacity: 0.5; }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card__value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--wc-stat-value);
    margin: 0 0 0.35rem;
    transition: color 0.2s ease, transform 0.15s ease;
}

.stat-card__value--sm {
    font-size: 2rem;
}

.stat-card__value.is-updated {
    animation: statPulse 0.25s ease;
}

@keyframes statPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.stat-card__label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--wc-stat-label);
    margin: 0;
}

/* Density table */
.density-header {
    background-color: var(--wc-density-header-bg);
    color: var(--wc-density-header-color);
    font-weight: 600;
    border-bottom: none;
}

.frequency-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.frequency-table td {
    vertical-align: middle;
    font-size: 0.875rem;
}

.frequency-table .word-cell {
    font-weight: 500;
}

.density-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.density-bar {
    flex: 1;
    height: 6px;
    background: var(--wc-bar-bg);
    border-radius: 3px;
    overflow: hidden;
}

.density-bar__fill {
    height: 100%;
    background: var(--wc-accent-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
    min-width: 2px;
}

.density-pct {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    color: var(--wc-stat-label);
    min-width: 3rem;
    text-align: right;
}

/* Info & FAQ */
.info-card {
    border: none;
    background: var(--wc-card-bg);
}

.info-card .card-body {
    transition: background-color 0.2s ease;
}

.faq-item {
    background: var(--wc-faq-bg);
    border: 1px solid var(--wc-stat-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.faq-item summary {
    font-weight: 600;
    cursor: pointer;
    list-style-position: outside;
}

.faq-item summary:hover {
    color: var(--wc-accent-primary);
}

.faq-item[open] summary {
    margin-bottom: 0.25rem;
}

#theme-toggle {
    min-width: 7.5rem;
}

.seo-intro strong {
    font-weight: 600;
}

.site-footer a {
    text-decoration: none;
}

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

.card {
    border: none;
    transition: background-color 0.2s ease;
}

[data-bs-theme="dark"] .card {
    background-color: var(--wc-card-bg);
}

@media (max-width: 575.98px) {
    .stat-card__value {
        font-size: 2rem;
    }

    .stat-card__value--sm {
        font-size: 1.5rem;
    }

    .stat-card {
        padding: 1rem 0.75rem;
    }
}

@media (max-width: 991.98px) {
    .text-input {
        min-height: 8rem;
    }
}
