

:root {
    --cse-accent: #1a73e8;
    --cse-accent-hover: #1765cc;
    --cse-link: #1a0dab;
    --cse-link-visited: #681da8;
    --cse-url: #006621;
    --cse-desc: #4d5156;
    --cse-radius: 28px;
    --cse-shadow: 0 1px 6px rgba(32, 33, 36, 0.18);
    --cse-shadow-hover: 0 2px 10px rgba(32, 33, 36, 0.28);
}

[data-bs-theme="dark"] {
    --cse-link: #8ab4f8;
    --cse-link-visited: #c58af9;
    --cse-url: #80c995;
    --cse-desc: #bdc1c6;
    --cse-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
    --cse-shadow-hover: 0 2px 12px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }

body {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color .25s ease, color .25s ease;
}

a { text-decoration: none; }


.theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1050;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}
.theme-toggle:hover {
    transform: rotate(20deg) scale(1.08);
    box-shadow: var(--cse-shadow);
}


.home-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
}

.home-logo {
    font-size: clamp(2.6rem, 8vw, 4.6rem);
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 1.8rem;
    animation: fadeInDown .6s ease both;
}
.home-logo img { max-height: 96px; max-width: 90vw; }

.brand-c1 { color: #4285f4; }
.brand-c2 { color: #ea4335; }
.brand-c3 { color: #fbbc05; }
.brand-c4 { color: #34a853; }


.search-form {
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
    animation: fadeInUp .6s ease both;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--cse-radius);
    box-shadow: var(--cse-shadow);
    padding: 4px 8px 4px 16px;
    transition: box-shadow .2s ease, border-color .2s ease;
    background: var(--bs-body-bg);
}
.search-box:hover,
.search-box:focus-within {
    box-shadow: var(--cse-shadow-hover);
    border-color: transparent;
}

.search-box .bi-search {
    color: #9aa0a6;
    font-size: 1.15rem;
    margin-right: 10px;
}

.search-box input[type="text"] {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.05rem;
    padding: 12px 6px;
    color: var(--bs-body-color);
}

.search-box .clear-btn {
    border: none;
    background: transparent;
    color: #9aa0a6;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 8px;
    display: none;
}
.search-box .clear-btn.show { display: inline-block; }


.btn-search {
    background: var(--cse-accent);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 10px 26px;
    margin-top: 1.6rem;
    font-size: .95rem;
    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}
.btn-search:hover {
    background: var(--cse-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, .35);
    color: #fff;
}
.btn-search:active { transform: translateY(0); }


.suggest-box {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 14px;
    box-shadow: var(--cse-shadow-hover);
    overflow: hidden;
    z-index: 1040;
    display: none;
}
.suggest-box.show { display: block; animation: fadeIn .15s ease; }
.suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    cursor: pointer;
    color: var(--bs-body-color);
    transition: background .12s ease;
}
.suggest-item:hover,
.suggest-item.active { background: var(--bs-tertiary-bg); }
.suggest-item .bi { color: #9aa0a6; }


.results-header {
    border-bottom: 1px solid var(--bs-border-color);
    padding: 14px 0;
    margin-bottom: 6px;
    position: sticky;
    top: 0;
    background: var(--bs-body-bg);
    z-index: 1020;
}
.results-header .home-mini {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.5px;
}
.results-header .search-form { margin: 0; max-width: 520px; }
.results-header .search-box { padding: 2px 6px 2px 14px; }
.results-header .search-box input { padding: 9px 6px; font-size: .98rem; }

.results-count {
    color: #70757a;
    font-size: .85rem;
    margin: 14px 0 6px;
}


.result-item {
    padding: 16px 0;
    max-width: 640px;
    animation: fadeInUp .35s ease both;
}
.result-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.favicon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    object-fit: cover;
    overflow: hidden;
}
.result-url {
    color: var(--cse-url);
    font-size: .82rem;
    line-height: 1.2;
    word-break: break-all;
}
.result-title {
    color: var(--cse-link);
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 2px 0 4px;
    display: inline-block;
}
.result-title:hover { text-decoration: underline; }
.result-title:visited { color: var(--cse-link-visited); }
.result-desc {
    color: var(--cse-desc);
    font-size: .92rem;
    line-height: 1.55;
    margin-bottom: 8px;
}
.result-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.result-date {
    color: #70757a;
    font-size: .8rem;
}
.btn-open {
    font-size: .8rem;
    padding: 4px 14px;
    border-radius: 18px;
    border: 1px solid var(--cse-accent);
    color: var(--cse-accent);
    transition: all .18s ease;
}
.btn-open:hover {
    background: var(--cse-accent);
    color: #fff;
}


.no-result {
    text-align: center;
    padding: 60px 16px;
    max-width: 520px;
    margin: 0 auto;
    animation: fadeIn .4s ease both;
}
.no-result .emoji { font-size: 3.4rem; margin-bottom: 1rem; opacity: .8; }
.no-result h2 { font-size: 1.25rem; font-weight: 500; }
.no-result .query { font-weight: 700; color: var(--cse-accent); }


.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
[data-bs-theme="dark"] .loading-overlay { background: rgba(0,0,0,.6); }
.loading-overlay.show { display: flex; }


.site-footer {
    margin-top: auto;
    padding: 18px 0;
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
    color: #70757a;
    font-size: .85rem;
}
.site-footer a { color: #70757a; }
.site-footer a:hover { color: var(--cse-accent); }


@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }


@media (max-width: 576px) {
    .home-logo { margin-bottom: 1.2rem; }
    .btn-search { width: 100%; }
    .results-header .home-mini { font-size: 1.25rem; }
}