:root {
    --sg-orange: #ff6600;
    --sg-orange-h: #ff7619;
    --sg-orange-d: #e85d00;
    --sg-blue: #2440b3;
    --sg-blue-h: #315efb;
    --sg-green: #00802a;
    --sg-text: #333;
    --sg-muted: #999;
    --sg-line: #ebebeb;
    --sg-bg: #fafafa;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    min-height: 100%;
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--sg-text);
    background: #fff;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--sg-blue); text-decoration: none; }
a:hover { color: var(--sg-blue-h); text-decoration: underline; }

.sg-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #fff 0%, #fafafa 55%, #fff 100%);
}

/* ── 结果页顶栏 ── */
.sg-head {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 18px 32px;
    background: #fff;
    border-bottom: 1px solid var(--sg-line);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}
.sg-logo-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
}
.sg-logo-mini:hover { text-decoration: none; opacity: .88; }
.sg-logo-mini svg { width: 32px; height: 32px; }
.sg-logo-mini span {
    font-size: 22px;
    font-weight: 700;
    color: var(--sg-orange);
    letter-spacing: 1px;
}

/* ── 首页顶栏（仅 tabs） ── */
.sg-top {
    padding: 20px 24px 0;
}
.sg-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 24px;
}
.sg-tab {
    font-size: 14px;
    color: #666;
    padding: 6px 4px 8px;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}
.sg-tab:hover { color: var(--sg-orange); text-decoration: none; }
.sg-tab.is-on {
    color: var(--sg-orange);
    font-weight: 600;
    border-bottom-color: var(--sg-orange);
}

/* ── 搜索框 ── */
.sg-search {
    display: flex;
    align-items: stretch;
    height: 44px;
}
.sg-search-head {
    flex: 1;
    min-width: 0;
    max-width: 640px;
}
.sg-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    border: 2px solid var(--sg-orange);
    border-right: 0;
    background: #fff;
    border-radius: 4px 0 0 4px;
    transition: box-shadow .15s;
}
.sg-input-wrap:focus-within {
    box-shadow: 0 0 0 3px rgba(255, 102, 0, .12);
}
.sg-input-icon {
    width: 18px;
    height: 18px;
    margin-left: 14px;
    flex-shrink: 0;
    color: #bbb;
}
.sg-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    padding: 0 14px;
    font-size: 16px;
    outline: none;
    background: transparent;
    color: var(--sg-text);
}
.sg-search input::placeholder { color: #bbb; }
.sg-search button {
    flex-shrink: 0;
    min-width: 108px;
    border: 0;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, #ff7619 0%, var(--sg-orange) 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s, transform .05s;
}
.sg-search button:hover { filter: brightness(1.06); }
.sg-search button:active { transform: scale(.98); }

/* ── 首页 ── */
.sg-main-home {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 60px;
    margin-top: -5vh;
}

.sg-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 36px;
    text-decoration: none;
}
.sg-logo:hover { text-decoration: none; opacity: .92; }
.sg-logo-dog {
    width: 88px;
    height: 88px;
    margin-bottom: 12px;
    filter: drop-shadow(0 8px 20px rgba(255, 102, 0, .25));
}
.sg-logo-text {
    font-size: 64px;
    font-weight: 700;
    color: var(--sg-orange);
    letter-spacing: 6px;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(255, 102, 0, .08);
}
.sg-logo-sub {
    margin-top: 10px;
    font-size: 14px;
    color: var(--sg-muted);
    letter-spacing: 2px;
}

.sg-search-main {
    width: min(680px, 94vw);
    height: 48px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .08);
    border-radius: 4px;
}
.sg-search-main .sg-input-wrap {
    border-radius: 4px 0 0 4px;
}
.sg-search-main button {
    min-width: 120px;
    font-size: 17px;
}

.sg-hot {
    margin-top: 22px;
    font-size: 13px;
    color: var(--sg-muted);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 14px;
}
.sg-hot span { color: #aaa; }
.sg-hot a {
    color: #666;
    text-decoration: none;
    padding: 2px 0;
    border-bottom: 1px dashed transparent;
}
.sg-hot a:hover {
    color: var(--sg-orange);
    border-bottom-color: rgba(255, 102, 0, .35);
    text-decoration: none;
}

/* ── 结果页 ── */
.sg-main {
    flex: 1;
    width: min(780px, 100%);
    margin: 0 auto;
    padding: 24px 24px 48px;
}
.sg-main-result { padding-top: 20px; }
.sg-meta {
    margin: 0 0 20px;
    color: var(--sg-muted);
    font-size: 13px;
}
.sg-meta b { color: #666; font-weight: 600; }

.sg-results { display: flex; flex-direction: column; }
.sg-item {
    padding: 16px 0;
    border-bottom: 1px solid #f2f2f2;
}
.sg-item:first-child { padding-top: 0; }
.sg-item:last-child { border-bottom: 0; }
.sg-item h3 {
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.45;
}
.sg-item h3 a {
    color: var(--sg-blue);
    text-decoration: none;
}
.sg-item h3 a:hover {
    color: var(--sg-blue-h);
    text-decoration: underline;
}
.sg-url {
    margin: 0 0 6px;
    color: var(--sg-green);
    font-size: 13px;
    line-height: 1.4;
    word-break: break-all;
}
.sg-snippet {
    margin: 0;
    color: #666;
    font-size: 13px;
    line-height: 1.7;
}

.sg-empty {
    text-align: center;
    padding: 48px 20px;
    color: #555;
}
.sg-empty-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 16px;
    opacity: .6;
}
.sg-empty-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}
.sg-empty-q {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--sg-orange);
}
.sg-empty ul {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    color: var(--sg-muted);
    line-height: 2;
}

/* ── 页脚 ── */
.sg-foot {
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    text-align: center;
    background: #fff;
    border-top: 1px solid var(--sg-line);
}
.sg-foot-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
    margin-bottom: 8px;
}
.sg-foot-links a {
    color: #aaa;
    font-size: 12px;
    text-decoration: none;
}
.sg-foot-links a:hover { color: #888; text-decoration: underline; }
.sg-foot p { margin: 0; color: #ccc; font-size: 12px; }

/* ── 手机 ── */
.is-mobile .sg-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 14px 14px;
}
.is-mobile .sg-search-head { max-width: none; }
.is-mobile .sg-top { padding-top: calc(16px + env(safe-area-inset-top)); }
.is-mobile .sg-main-home {
    margin-top: 0;
    justify-content: flex-start;
    padding-top: 12vh;
}
.is-mobile .sg-logo-dog { width: 72px; height: 72px; }
.is-mobile .sg-logo-text { font-size: 48px; letter-spacing: 4px; }
.is-mobile .sg-search-main { height: 44px; }
.is-mobile .sg-search-main button { min-width: 96px; font-size: 15px; }
.is-mobile .sg-item h3 { font-size: 16px; }
.is-mobile.is-result .sg-head {
    flex-direction: row;
    align-items: center;
    padding-top: calc(12px + env(safe-area-inset-top));
}
.is-mobile.is-result .sg-logo-mini span { display: none; }
.is-mobile.is-result .sg-search-head { flex: 1; }
.is-mobile.is-result .sg-search button { min-width: 72px; }
.is-mobile.is-result .sg-search button span { font-size: 14px; }

@media (max-width: 480px) {
    .sg-tabs { gap: 4px 14px; }
    .sg-tab { font-size: 13px; }
    .sg-hot { font-size: 12px; gap: 4px 10px; }
}
