:root {
  --accent: #fc6744;
  --accent-ink: #f05a36;
  --accent-soft: rgba(252, 103, 68, 0.12);
  --accent-ring: rgba(252, 103, 68, 0.22);
  --bg: #fff;
  --field-bg: #fff;
  --text: #222;
  --text-strong: #161616;
  --muted: #767676;
  --faint: #9a9a9a;
  --placeholder: #a8a8a8;
  --line: #eeeeee;
  --hover-bg: #f2f2f2;
  --selection: #ffdcd2;
  --serp-bg: #f2f2f2;
  --card: #fff;
  --card-text: rgba(0, 0, 0, 0.87);
  --card-muted: rgba(0, 0, 0, 0.5);
  --tab-muted: rgba(0, 0, 0, 0.5);
  --chip: rgba(0, 0, 0, 0.05);
  --chip-hover: rgba(0, 0, 0, 0.08);
  --menu-shadow: 0 6px 24px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.05);
  --title: #1a2a8f;
  --title-visited: #603090;
  --serp-col: 720px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent-ink: #fc6744;
    --accent-soft: rgba(252, 103, 68, 0.16);
    --accent-ring: rgba(252, 103, 68, 0.3);
    --bg: #1a1a1a;
    --field-bg: #1e1e1e;
    --text: #e2e2e2;
    --text-strong: #f3f3f3;
    --muted: #9b9b9b;
    --faint: #7c7c7c;
    --placeholder: #7a7a7a;
    --line: #2b2b2b;
    --hover-bg: #2a2a2a;
    --selection: rgba(252, 103, 68, 0.35);
    --serp-bg: #050505;
    --card: #1a1a1a;
    --card-text: rgba(255, 255, 255, 0.87);
    --card-muted: rgba(255, 255, 255, 0.5);
    --tab-muted: rgba(255, 255, 255, 0.5);
    --chip: rgba(255, 255, 255, 0.08);
    --chip-hover: rgba(255, 255, 255, 0.12);
    --menu-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
    --title: #9db4ff;
    --title-visited: #b79ce6;
  }
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-strong);
}

body {
  font-family: Arial, Helvetica, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input { font-family: inherit; }

a { -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.logo {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

.logo-home { font-size: 52px; }

.logo-small { font-size: 22px; letter-spacing: -0.03em; }

.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22vh 20px 80px;
}

.searchbar {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 56px;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--field-bg);
  padding: 0 6px 0 18px;
  transition: box-shadow 0.15s ease;
}

.searchbar:focus-within { box-shadow: 0 0 0 4px var(--accent-ring); }

.searchbar-icon {
  flex: none;
  color: var(--accent);
}

.searchbar input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 0 8px 0 10px;
  color: var(--text-strong);
}

.searchbar input::placeholder { color: var(--placeholder); }

.searchbar-home input:placeholder-shown { text-align: center; }

.searchbar input::-webkit-search-cancel-button,
.searchbar input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.searchbar-home {
  width: min(584px, calc(100vw - 40px));
  height: 60px;
  margin-top: 40px;
}

.searchbar button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.searchbar button[type="submit"]:hover { background: var(--accent-soft); }
.searchbar button[type="submit"]:active { background: var(--accent-ring); }

.searchbar .clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.searchbar .clear:hover { background: var(--hover-bg); color: var(--text-strong); }

.searchbar .clear[hidden] { display: none; }

.topbar,
.serp { display: none; }

html.mode-serp .home { display: none; }

html.mode-serp,
html.mode-serp body { background: var(--serp-bg); }

html.mode-serp body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

html.mode-serp .topbar {
  display: block;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
  border-radius: 0 0 20px 20px;
  box-shadow: 0 1px 0 var(--line);
}

.topbar-inner {
  max-width: var(--serp-col);
  margin: 0 auto;
  padding: 12px 12px 0;
}

.searchbar-top {
  height: 48px;
  padding: 0 4px 0 3px;
}

.mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font: 700 22px/1 Arial, Helvetica, sans-serif;
  text-decoration: none;
}

.searchbar-top input {
  font-size: 17px;
  padding: 0 6px 0 12px;
}

.searchbar-top .clear { width: 36px; height: 36px; }

.searchbar-top button[type="submit"] {
  height: 38px;
  padding: 0 14px;
}

.tabs {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 6px;
  margin-top: 4px;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  flex: none;
  padding: 12px 0 13px;
  font-size: 16px;
  line-height: 20px;
  color: var(--tab-muted);
  text-decoration: none;
  white-space: nowrap;
}

.tab[aria-disabled="true"] { cursor: default; }

.tab-active {
  color: var(--text-strong);
  font-weight: 600;
}

.tab-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: currentColor;
}

html.mode-serp .serp {
  display: block;
  max-width: var(--serp-col);
  min-width: 0;
  margin: 0 auto;
  padding: 8px 8px 24px;
  overflow-x: clip;
}

.stats,
.message,
.results,
.pager {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.stats {
  margin: 4px 10px 8px;
  color: var(--card-muted);
  font-size: 13px;
  line-height: 18px;
}

.stats:empty { display: none; }

.message {
  margin: 0 0 8px;
  padding: 18px 16px;
  border-radius: 16px;
  background: var(--card);
  color: var(--card-text);
  font-size: 16px;
  line-height: 1.45;
}

.results {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result {
  margin: 0 0 8px;
  padding: 14px 16px 16px;
  min-width: 0;
  max-width: 100%;
  border-radius: 16px;
  background: var(--card);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-bottom: 8px;
}

.result-favicon {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--chip);
  overflow: hidden;
}

.result-favicon-letter {
  color: var(--card-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.result-favicon img {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 18px;
  height: 18px;
}

.result-favicon.has-icon .result-favicon-letter { visibility: hidden; }

.result-source {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.result-site,
.result-crumbs {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.result-site {
  color: var(--card-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
}

.result-crumbs {
  color: var(--card-muted);
  font-size: 13px;
  line-height: 17px;
}

.result-more {
  position: relative;
  flex: none;
  align-self: flex-start;
  margin: -4px -10px 0 0;
}

.result-more-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--card-muted);
  cursor: pointer;
}

.result-more-button:hover,
.result-more-button[aria-expanded="true"] { background: var(--chip); }

.result-menu {
  position: absolute;
  top: 38px;
  right: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  padding: 6px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--menu-shadow);
}

.result-menu[hidden] { display: none; }

.result-menu a,
.result-menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--card-text);
  font-size: 15px;
  line-height: 20px;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.result-menu a:hover,
.result-menu button:hover { background: var(--chip); }

.result-title {
  display: block;
  max-width: 100%;
  min-width: 0;
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  color: var(--title);
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-title:visited { color: var(--title-visited); }
.result-title:hover { text-decoration: underline; }

.result-snippet {
  margin: 6px 0 0;
  max-width: 100%;
  min-width: 0;
  font-size: 15px;
  line-height: 21px;
  color: var(--card-text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-title mark,
.result-snippet mark {
  background: transparent;
  color: inherit;
  font-weight: 700;
  padding: 0;
}

.result-sitelinks {
  margin-top: 10px;
  font-size: 15px;
  line-height: 22px;
}

.result-sitelinks a {
  color: var(--title);
  font-weight: 500;
  text-decoration: none;
}

.result-sitelinks a:hover { text-decoration: underline; }

.result-sitelinks a + a::before {
  content: "·";
  display: inline-block;
  margin: 0 8px;
  color: var(--card-muted);
  font-weight: 400;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 4px;
  font-size: 15px;
}

.pager:empty { display: none; }

.pager a,
.pager .current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--card);
  color: var(--title);
  text-decoration: none;
}

.pager a:hover { background: var(--chip-hover); }
.pager .current { background: var(--chip); color: var(--text-strong); font-weight: 700; }

.serp-brand {
  margin: 28px 0 8px;
  text-align: center;
}

.serp-brand .logo-small { font-size: 18px; }

.footer {
  color: var(--faint);
  font-size: 12px;
}

html.mode-home .footer,
html:not(.mode-serp) .footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
}

html.mode-serp .footer { display: none; }

.noscript {
  width: min(584px, calc(100vw - 32px));
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection { background: var(--selection); }

@media (min-width: 1024px) {
  :root {
    --pc-bar-left: 100px;
    --pc-col-left: 44px;
    --pc-col: 628px;
    --pc-gutter: 72px;
  }

  html.mode-serp .topbar {
    border-radius: 0;
    box-shadow: 0 1px 0 var(--line);
  }

  html.mode-serp .topbar-inner {
    max-width: none;
    margin: 0;
    padding: 10px 24px 0 var(--pc-bar-left);
  }

  .searchbar-top {
    width: calc(var(--pc-col-left) + var(--pc-col) - var(--pc-bar-left));
    height: 52px;
    padding: 0 6px 0 5px;
  }

  .searchbar-top .mark {
    width: 36px;
    height: 36px;
    font-size: 21px;
  }

  .searchbar-top input {
    font-size: 18px;
    padding: 0 8px 0 14px;
  }

  .searchbar-top button[type="submit"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .tabs {
    gap: 22px;
    margin-top: 6px;
    padding: 0 0 0 calc(var(--pc-col-left) + var(--pc-gutter) - var(--pc-bar-left));
    overflow: visible;
  }

  .tab {
    padding: 10px 0 12px;
    font-size: 14px;
  }

  .tab:not(.tab-active):not([aria-disabled="true"]):hover { color: var(--text-strong); }

  .tab-active { font-weight: 500; }

  .tab-active::after { height: 2px; }

  html.mode-serp .serp {
    max-width: none;
    width: calc(var(--pc-col-left) + var(--pc-col));
    margin: 0;
    padding: 10px 0 40px var(--pc-col-left);
    overflow-x: visible;
  }

  .stats { display: none; }

  .message {
    padding: 16px 20px 16px var(--pc-gutter);
    border-radius: 14px;
    font-size: 15px;
  }

  .result {
    position: relative;
    margin: 0 0 14px;
    padding: 12px 44px 14px var(--pc-gutter);
    border-radius: 14px;
  }

  .result-head {
    gap: 0;
    margin-bottom: 4px;
  }

  .result-favicon {
    position: absolute;
    top: 14px;
    left: 20px;
    width: 32px;
    height: 32px;
  }

  .result-favicon img {
    top: 8px;
    left: 8px;
    width: 16px;
    height: 16px;
  }

  .result-site { font-size: 14px; }

  .result-more {
    position: absolute;
    top: 8px;
    right: 6px;
    margin: 0;
  }

  .result-more-button {
    width: 30px;
    height: 32px;
    border-radius: 8px;
  }

  .result-title {
    font-size: 18px;
    font-weight: 400;
  }

  .result-title mark { font-weight: inherit; }

  .result-snippet {
    margin-top: 4px;
    font-size: 14px;
    line-height: 20px;
  }

  .result-sitelinks {
    margin-top: 6px;
    font-size: 14px;
    line-height: 20px;
  }

  .result-sitelinks a { font-weight: 400; }

  .pager {
    justify-content: flex-start;
    gap: 6px;
    margin: 20px 0 4px;
    padding-left: var(--pc-gutter);
    font-size: 14px;
  }

  .pager a,
  .pager .current {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
  }

  .serp-brand {
    margin-top: 32px;
    padding-left: var(--pc-gutter);
    text-align: left;
  }
}

@media (max-width: 720px) {
  .home { padding-top: 24vh; }
  .logo-home { font-size: 42px; }
  .searchbar-home { margin-top: clamp(48px, 13vh, 132px); }
  .searchbar-home button[type="submit"] { min-height: 44px; }
}

@media (max-height: 520px) {
  .home {
    min-height: auto;
    padding-top: 48px;
  }

  html.mode-home .footer,
  html:not(.mode-serp) .footer {
    position: static;
    margin: 28px 0 16px;
  }
}
