:root {
    --primary: #1e3a8a;
    --secondary: #2563eb;
    --accent: #f59e0b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3.5rem 1.5rem 5rem;
    position: relative;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header:hover {
    cursor: pointer;
    scale: 1.05;
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.04em;
    line-height: 1;
}

.logo span {
    color: var(--accent);
}

.tagline {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}

/*  Search box  */
.search-wrap {
    width: 100%;
    max-width: 640px;
    position: relative;
    margin-bottom: 0.875rem;
}

.search-wrap .icon-search {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.875rem;
    color: var(--muted);
    pointer-events: none;
    transition: color 0.2s;
}

.search-wrap:focus-within .icon-search {
    color: var(--secondary);
}

#searchInput {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 2.75rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);
}

#searchInput:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
}

#searchInput::placeholder {
    color: var(--muted);
}


/*  Stats  */
#stats {
    width: 100%;
    max-width: 75px;
    font-size: 0.72rem;
    color: var(--muted);
    min-height: 1.1em;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/*  Filters  */
.filters {
    width: 100%;
    max-width: 640px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.filter-btn {
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.15s;
    letter-spacing: 0.01em;
}

.filter-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary);
    background: #eff6ff;
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/*  Results  */
#results {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.result-item {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.result-item:hover {
    border-color: var(--secondary);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
    transform: translateY(-1px);
}

.result-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-calc {
    background: #dbeafe;
}

.icon-guide {
    background: #fef3c7;
}

.icon-calc i {
    color: #1d4ed8;
    font-size: 1rem;
}

.icon-guide i {
    color: #b45309;
    font-size: 1rem;
}

.result-badge {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.18rem 0.5rem;
    border-radius: 4px;
}

.badge-calc {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-guide {
    background: #fef3c7;
    color: #b45309;
}

.result-text {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.1rem;
    font-weight: 500;
}

.result-arrow {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: #cbd5e1;
    transition: color 0.15s, transform 0.15s;
}

.result-item:hover .result-arrow {
    color: var(--secondary);
    transform: translateX(2px);
}

/*  Empty / hint states  */
.state-msg {
    width: 100%;
    max-width: 640px;
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.9;
}

.state-msg .state-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.state-msg strong {
    color: var(--text);
    font-size: 0.95rem;
    display: block;
    margin-bottom: 0.3rem;
}

mark {
    background: #fef08a;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* Back button */
.btn-back {
    flex-shrink: 0;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.15s, border-color 0.15s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-back:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* Row that holds the back button + search input together */
.search-row {
    width: 100%;
    max-width: 640px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

.search-row .search-wrap {
    flex: 1;
    max-width: none;
    margin-bottom: 0;
}

.blog-logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 1.7rem;
    color: #1e3a8a;
    letter-spacing: -0.02em;
}

.blog-logo .logo-dot {
    color: #f59e0b;
}

@media (max-width: 480px) {
    body {
        padding: 2rem 1rem 3rem;
    }

    .logo {
        font-size: 1.65rem;
    }
}