:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #202124;
  --muted: #4d5156;
  --subtle: #70757a;
  --link: #1a0dab;
  --link-visited: #681da8;
  --accent: #1a73e8;
  --border: #dfe1e5;
  --hover: #f1f3f4;
  --button: #f8f9fa;
  --shadow: 0 1px 6px rgba(32, 33, 36, .28);
  --mark: transparent;
  --c0: #1a73e8; --c1: #d93025; --c2: #f9ab00; --c3: #188038;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202124;
    --surface: #303134;
    --text: #e8eaed;
    --muted: #bdc1c6;
    --subtle: #9aa0a6;
    --link: #8ab4f8;
    --link-visited: #c58af9;
    --accent: #8ab4f8;
    --border: #5f6368;
    --hover: #3c4043;
    --button: #303134;
    --shadow: 0 1px 6px rgba(0, 0, 0, .5);
    --c0: #8ab4f8; --c1: #f28b82; --c2: #fdd663; --c3: #81c995;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.58 Arial, "Helvetica Neue", Helvetica, sans-serif;
  min-height: 100vh;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Wordmark */
.wordmark { font-family: "Product Sans", "Google Sans", "Helvetica Neue", Arial, sans-serif; font-weight: 500; letter-spacing: -0.02em; margin: 0; user-select: none; }
.wordmark:hover { text-decoration: none; }
.wordmark-large { font-size: clamp(56px, 14vw, 92px); line-height: 1; margin-bottom: 28px; }
.wordmark-small { font-size: 28px; line-height: 1; flex: none; }
.c0 { color: var(--c0); } .c1 { color: var(--c1); } .c2 { color: var(--c2); } .c3 { color: var(--c3); }

/* Home */
body.home { display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: flex-end; padding: 16px 20px; }
.topbar nav { display: flex; gap: 16px; }
.topbar a { color: var(--text); font-size: 13px; }
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 12vh 16px 0; }
.home .search-form { width: min(584px, 100%); }
.buttons { display: flex; justify-content: center; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.button {
  background: var(--button); color: var(--text); border: 1px solid var(--button);
  border-radius: 4px; font: inherit; padding: 0 16px; height: 36px; cursor: pointer;
}
.button:hover { border-color: var(--border); box-shadow: 0 1px 1px rgba(0,0,0,.1); }
.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 14px 24px; background: var(--hover); color: var(--subtle); font-size: 13px;
}

/* Search box + suggestions */
.search-box { position: relative; display: flex; align-items: center; }
.search-box .icon { position: absolute; left: 14px; width: 20px; height: 20px; fill: var(--subtle); pointer-events: none; }
.search-box input {
  width: 100%; height: 46px; padding: 0 20px 0 46px;
  font: 16px Arial, sans-serif; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 24px; outline: none;
}
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
.search-box input:hover, .search-box input:focus { box-shadow: var(--shadow); border-color: transparent; }
.search-box.open input { border-radius: 24px 24px 0 0; box-shadow: var(--shadow); border-color: transparent; }
.suggestions {
  position: absolute; top: 46px; left: 0; right: 0; z-index: 10;
  margin: 0; padding: 0 0 8px; list-style: none;
  background: var(--surface); border-radius: 0 0 24px 24px; box-shadow: 0 4px 6px rgba(32,33,36,.28);
  border-top: 1px solid var(--border);
}
.suggestions li { display: flex; align-items: center; gap: 14px; padding: 6px 20px 6px 16px; cursor: pointer; color: var(--text); }
.suggestions li::before {
  content: ""; flex: none; width: 16px; height: 16px; opacity: .6;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.suggestions li[aria-selected="true"], .suggestions li:hover { background: var(--hover); }
.suggestions b { font-weight: 700; }

/* Results page */
.serp-header {
  display: flex; align-items: center; gap: 28px; padding: 20px 24px 16px 28px;
  border-bottom: 1px solid var(--border);
}
.serp-header .search-form { flex: 1; max-width: 692px; }
.serp-main { padding: 12px 24px 48px 180px; max-width: 832px; }
.stats { color: var(--subtle); margin: 0 0 20px; }
.results { list-style: none; margin: 0; padding: 0; }
.result { margin-bottom: 30px; max-width: 652px; }
.result-link { display: block; }
.result-link:hover { text-decoration: none; }
.result-link:hover h3 { text-decoration: underline; }
.result-link:visited h3 { color: var(--link-visited); }
.result-source { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.favicon {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--hover); color: var(--accent); border: 1px solid var(--border);
}
.source-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.site { color: var(--text); font-size: 14px; }
cite { color: var(--muted); font-style: normal; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result h3 { font-size: 20px; font-weight: 400; line-height: 1.3; margin: 0 0 3px; color: var(--link); }
.snippet { color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.snippet mark { background: var(--mark); color: inherit; font-weight: 700; }
.no-results { color: var(--text); }
.no-results ul { padding-left: 24px; }
.pagination { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 40px; align-items: center; }
.pagination a, .pagination span { min-width: 32px; padding: 6px 8px; text-align: center; border-radius: 4px; }
.pagination a:hover { background: var(--hover); text-decoration: none; }
.pagination span[aria-current] { font-weight: 700; color: var(--text); }
.prose { line-height: 1.6; }
.prose code { background: var(--hover); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.error { color: var(--c1); }

@media (max-width: 900px) {
  .serp-main { padding-left: 24px; }
}
@media (max-width: 600px) {
  .serp-header { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
  .serp-header .wordmark { align-self: center; }
  .serp-main { padding: 12px 16px 40px; }
  .result h3 { font-size: 18px; }
  .footer { justify-content: center; text-align: center; }
}