:root {
    --bg: #ffffff;
    --bg-soft: #f8f9fa;
    --ink: #202124;
    --muted: #5f6368;
    --link: #1a0dab;
    --link-visited: #681da8;
    --url: #202124;
    --green: #188038;
    --line: #dfe1e5;
    --blue: #1a73e8;
    --max: 692px;
    --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.ms-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.ms-preview {
    background: #f1f3f4;
    color: var(--muted);
    text-align: center;
    padding: .5rem;
    font-size: .85rem;
    border-bottom: 1px solid var(--line);
}
.ms-preview a { color: var(--blue); }

/* —— Header —— */
.ms-header {
    border-bottom: 1px solid transparent;
}
.ms-header.is-compact {
    border-bottom-color: var(--line);
    background: var(--bg);
    position: sticky; top: 0; z-index: 20;
}
.ms-header-inner {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    min-height: 64px;
    display: flex; align-items: center; gap: 1rem;
    flex-wrap: wrap;
    padding: .65rem 0;
}
.ms-home .ms-header:not(.is-compact) .ms-logo-text { display: none; }
.ms-home .ms-header:not(.is-compact) { position: absolute; inset: 0 0 auto; border: 0; }
.ms-home .ms-header:not(.is-compact) .ms-header-inner { justify-content: flex-end; }

.ms-logo {
    display: inline-flex; align-items: center; gap: .5rem;
    font-weight: 600;
    letter-spacing: -.02em;
}
.ms-logo-mark {
    width: 28px; height: 28px; border-radius: 50%;
    background:
        conic-gradient(from 210deg, #ea4335, #fbbc05, #34a853, #4285f4, #ea4335);
    box-shadow: inset 0 0 0 3px #fff;
}
.ms-logo-mark-lg { width: 72px; height: 72px; box-shadow: inset 0 0 0 6px #fff; }
.ms-nav {
    display: flex; flex-wrap: wrap; gap: .15rem .9rem;
    margin-left: auto;
}
.ms-nav a {
    font-size: .85rem;
    color: var(--muted);
}
.ms-nav a:hover, .ms-nav a.is-active { color: var(--ink); }

/* —— Search field —— */
.ms-search {
    display: flex; align-items: center;
    gap: .35rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .15rem .15rem .15rem .95rem;
    transition: box-shadow .2s ease, border-color .2s ease;
}
.ms-search:hover, .ms-search:focus-within {
    border-color: transparent;
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}
.ms-search-icon { color: #9aa0a6; display: grid; place-content: center; }
.ms-search input {
    flex: 1;
    border: 0; outline: none; background: transparent;
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    min-width: 0;
    padding: .7rem .35rem;
}
.ms-search button {
    border: 0;
    border-radius: 999px;
    background: var(--bg-soft);
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
    font-weight: 500;
    padding: .7rem 1.15rem;
    cursor: pointer;
}
.ms-search button:hover { background: #e8eaed; }
.ms-clear {
    width: 36px; height: 36px;
    display: grid; place-content: center;
    color: #9aa0a6;
    font-size: 1.4rem;
    line-height: 1;
}
.ms-search-top { flex: 1 1 280px; max-width: 690px; }
.ms-search-hero {
    width: min(584px, 100%);
    margin: 0 auto;
}

.ms-main { min-height: calc(100vh - 120px); }
.ms-home .ms-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 1rem 6rem;
}

/* —— Splash —— */
.ms-splash {
    text-align: center;
    width: min(680px, 100%);
    margin: 0 auto;
}
.ms-splash-logo {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: .85rem;
    margin-bottom: 1.75rem;
}
.ms-splash-name {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 500;
    letter-spacing: -.04em;
    color: var(--ink);
}
.ms-lucky {
    display: flex; justify-content: center; flex-wrap: wrap; gap: .65rem;
    margin-top: 1.35rem;
}
.ms-btn {
    display: inline-flex; align-items: center; justify-content: center;
    border: 0;
    border-radius: 4px;
    background: var(--blue);
    color: #fff;
    font: inherit;
    font-size: .9rem;
    font-weight: 500;
    padding: .65rem 1.1rem;
    cursor: pointer;
}
.ms-btn-muted {
    background: var(--bg-soft);
    color: #3c4043;
    border: 1px solid transparent;
}
.ms-btn-muted:hover { border-color: #dadce0; box-shadow: 0 1px 1px rgba(0,0,0,.05); }
.ms-trending { margin-top: 2.5rem; }
.ms-trending p {
    margin: 0 0 .7rem;
    color: var(--muted);
    font-size: .85rem;
}
.ms-chips {
    display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem;
}
.ms-chips a {
    padding: .4rem .75rem;
    border-radius: 999px;
    background: var(--bg-soft);
    color: #3c4043;
    font-size: .82rem;
}
.ms-chips a:hover { background: #e8eaed; }

/* —— Results —— */
.ms-results-wrap {
    width: min(var(--max), calc(100% - 2rem));
    margin: 0 auto;
    padding: .5rem 0 3rem;
}
.ms-tabs {
    display: flex; flex-wrap: wrap; gap: .15rem 1.25rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: .85rem;
}
.ms-tab {
    border: 0; background: transparent;
    padding: .75rem 0;
    font: inherit;
    font-size: .9rem;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}
.ms-tab span {
    font-size: .78rem;
    color: #80868b;
    margin-left: .15rem;
}
.ms-tab.is-active {
    color: var(--blue);
    border-bottom-color: var(--blue);
    font-weight: 600;
}
.ms-stats {
    margin: 0 0 1.1rem;
    color: var(--muted);
    font-size: .85rem;
}
.ms-results { display: grid; gap: 1.35rem; }
.ms-result { position: relative; max-width: 650px; padding-right: 110px; }
.ms-result-url {
    display: block;
    font-size: .85rem;
    color: var(--url);
    margin-bottom: .15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ms-result h3 {
    margin: 0 0 .2rem;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.3;
}
.ms-result h3 a { color: var(--link); }
.ms-result h3 a:visited { color: var(--link-visited); }
.ms-result h3 a:hover { text-decoration: underline; }
.ms-result p {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.5;
}
.ms-result time { color: var(--muted); }
.ms-result-thumb {
    position: absolute;
    top: .2rem; right: 0;
    width: 92px; height: 92px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-soft);
}
.ms-result-thumb img { width: 100%; height: 100%; object-fit: cover; }

.ms-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .75rem;
}
.ms-media {
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-soft);
    border: 1px solid var(--line);
}
.ms-media img { aspect-ratio: 1; width: 100%; object-fit: cover; }
.ms-media span {
    display: block;
    padding: .45rem .55rem;
    font-size: .78rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-empty, .ms-empty-page {
    padding: 1.5rem 0;
    color: var(--muted);
}
.ms-empty h2, .ms-empty-page h1 {
    margin: 0 0 .5rem;
    color: var(--ink);
    font-weight: 400;
    font-size: 1.35rem;
}
.ms-cat-title, .ms-related-title {
    margin: .5rem 0 .35rem;
    font-size: 1.35rem;
    font-weight: 400;
}

/* —— Article —— */
.ms-doc {
    width: min(720px, calc(100% - 2rem));
    margin: 1rem auto 2.5rem;
}
.ms-breadcrumb {
    color: var(--muted);
    font-size: .85rem;
    margin: 0 0 1rem;
}
.ms-breadcrumb a:hover { text-decoration: underline; }
.ms-doc h1 {
    margin: 0 0 .5rem;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 400;
    line-height: 1.25;
}
.ms-doc-meta { margin: 0 0 1.25rem; color: var(--muted); font-size: .9rem; }
.ms-doc-cover {
    margin: 0 0 1.4rem;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-soft);
    aspect-ratio: 16 / 9;
}
.ms-doc-cover img { width: 100%; height: 100%; object-fit: cover; }
.ms-prose {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #3c4043;
}
.ms-prose p { margin: 0 0 1rem; }
.ms-prose h2 {
    margin: 1.6rem 0 .6rem;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--ink);
}

.ms-footer {
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
    color: var(--muted);
    font-size: .82rem;
}
.ms-footer-inner {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0;
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem;
}
.ms-footer a:hover { color: var(--ink); }

@media (max-width: 720px) {
    .ms-nav { display: none; }
    .ms-result { padding-right: 0; }
    .ms-result-thumb { display: none; }
    .ms-home .ms-header:not(.is-compact) .ms-header-inner { justify-content: center; }
}
