/* ==========================================================================
   Crux Search
   Crux System palette (paper/ink, atlantic + brass) on Apple-style
   materials: SF type tracking, glass chrome with a lit top edge,
   capsule controls, spring motion.
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;

  --text-large-title: 2.125rem; --text-title-2: 1.375rem; --text-title-3: 1.25rem;
  --text-headline: 1.0625rem; --text-body: 1rem; --text-subhead: .9375rem; --text-footnote: .8125rem; --text-caption: .75rem;
  --tracking-tight: -.022em; --tracking-snug: -.014em; --tracking-wide: .01em;

  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 22px;
  --ease-out: cubic-bezier(.23, 1, .32, 1); --ease-spring: cubic-bezier(.34, 1.32, .64, 1);
  --wrap: 1560px;   /* widest content row */
  --lead: 176px;    /* brand width: tabs, tools and results line up with the search field */

  /* light (paper) */
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-2: #efebe2;
  --label: #19242b;
  --label-2: #4d5b63;
  --label-3: #748089;
  --sep: rgba(32, 39, 36, .13);
  --sep-strong: rgba(32, 39, 36, .22);
  --fill-1: rgba(25, 36, 43, .1);
  --fill-2: rgba(25, 36, 43, .07);
  --fill-3: rgba(25, 36, 43, .045);
  --accent: #327491;
  --accent-strong: #245b73;
  --accent-soft: rgba(50, 116, 145, .12);
  --on-accent: #ffffff;
  --brass: #94651d;
  --brass-soft: rgba(183, 128, 43, .14);
  --link: #245b73;
  --visited: #6b4a86;
  --green: #2f8f6b;
  --red: #b73d37;
  --material: rgba(255, 253, 248, .74);
  --material-thick: rgba(255, 253, 248, .9);
  --spec: rgba(255, 255, 255, .7);
  --rim: rgba(25, 36, 43, .07);
  --shadow-1: 0 1px 2px rgba(25, 36, 43, .05), 0 1px 1px rgba(25, 36, 43, .04);
  --shadow-2: 0 2px 10px rgba(25, 36, 43, .07), 0 1px 2px rgba(25, 36, 43, .06);
  --shadow-float: 0 18px 55px rgba(25, 36, 43, .14);
  --glow-a: #4b9cbf; --glow-b: #b7802b; --glow-c: #7aa6c2;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151a; --surface: #172027; --surface-2: #1d2830;
    --label: #efeee8; --label-2: #b5bbb9; --label-3: #8a9496;
    --sep: rgba(239, 238, 232, .1); --sep-strong: rgba(239, 238, 232, .18);
    --fill-1: rgba(239, 238, 232, .14); --fill-2: rgba(239, 238, 232, .09); --fill-3: rgba(239, 238, 232, .055);
    --accent: #78b5ce; --accent-strong: #9ccbde; --accent-soft: rgba(120, 181, 206, .16); --on-accent: #0f151a;
    --brass: #dfb45f; --brass-soft: rgba(223, 180, 95, .14);
    --link: #8cc2d8; --visited: #c3a7dc; --green: #5cc29a; --red: #e07a73;
    --material: rgba(21, 29, 36, .74); --material-thick: rgba(23, 32, 39, .92);
    --spec: rgba(255, 255, 255, .08); --rim: rgba(0, 0, 0, .45);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 2px 10px rgba(0, 0, 0, .35); --shadow-float: 0 18px 55px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f151a; --surface: #172027; --surface-2: #1d2830;
  --label: #efeee8; --label-2: #b5bbb9; --label-3: #8a9496;
  --sep: rgba(239, 238, 232, .1); --sep-strong: rgba(239, 238, 232, .18);
  --fill-1: rgba(239, 238, 232, .14); --fill-2: rgba(239, 238, 232, .09); --fill-3: rgba(239, 238, 232, .055);
  --accent: #78b5ce; --accent-strong: #9ccbde; --accent-soft: rgba(120, 181, 206, .16); --on-accent: #0f151a;
  --brass: #dfb45f; --brass-soft: rgba(223, 180, 95, .14);
  --link: #8cc2d8; --visited: #c3a7dc; --green: #5cc29a; --red: #e07a73;
  --material: rgba(21, 29, 36, .74); --material-thick: rgba(23, 32, 39, .92);
  --spec: rgba(255, 255, 255, .08); --rim: rgba(0, 0, 0, .45);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3); --shadow-2: 0 2px 10px rgba(0, 0, 0, .35); --shadow-float: 0 18px 55px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--label);
  font-family: var(--font-sans); font-size: var(--text-body); line-height: 1.45;
  -webkit-font-smoothing: antialiased; font-optical-sizing: auto;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
img { max-width: 100%; }
.i { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); }
.skip:focus { top: 12px; }
.crux-mark { width: 26px; height: 24px; color: var(--accent); flex: none; }
.crux-mark.lg { width: 54px; height: 48px; }
.crux-mark.sm { width: 16px; height: 15px; }

/* ---------- materials & controls ---------- */
.glass {
  background: var(--material);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--spec), 0 0 0 .5px var(--rim), var(--shadow-float);
}
@media (prefers-reduced-transparency: reduce) { .glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (prefers-contrast: more) { .glass, .card, .field { box-shadow: 0 0 0 1px var(--label-2) !important; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 15px;
  border-radius: 999px; font-size: var(--text-subhead); font-weight: 500; white-space: nowrap; text-decoration: none !important;
  transition: transform .1s var(--ease-out), background .2s var(--ease-out), filter .1s;
}
.btn:active { transform: scale(.97); }
.btn .i { width: 17px; height: 17px; }
.btn.lg { min-height: 44px; padding: 0 20px; font-size: var(--text-body); }
.btn-gray { background: var(--fill-2); color: var(--label); }
.btn-gray:hover { background: var(--fill-1); }
.btn-filled { background: var(--accent); color: var(--on-accent); }
.btn-filled:active { filter: brightness(.92); }
.btn-ai { color: var(--label); background: var(--surface); box-shadow: 0 0 0 1px var(--sep), var(--shadow-1); position: relative; }
.btn-ai .i { color: var(--accent); }
.btn-ai:hover { box-shadow: 0 0 0 1px var(--accent), var(--shadow-2); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--label-2); transition: background .2s var(--ease-out), transform .1s; }
.icon-btn:hover { background: var(--fill-2); }
.icon-btn:active { transform: scale(.92); }
.icon-btn .i { width: 20px; height: 20px; }
.link-btn { font-size: var(--text-footnote); color: var(--accent-strong); font-weight: 500; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); box-shadow: 0 0 0 .5px var(--sep), var(--shadow-1); color: var(--label);
  font-size: var(--text-footnote); text-decoration: none !important; transition: transform .1s var(--ease-out), box-shadow .2s;
}
.chip:hover { box-shadow: 0 0 0 .5px var(--sep-strong), var(--shadow-2); }
.chip:active { transform: scale(.97); }
.chip .i { width: 15px; height: 15px; color: var(--label-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.center { justify-content: center; }

/* ---------- search field ---------- */
.field-wrap { position: relative; width: 100%; }
.field {
  display: flex; align-items: center; gap: 4px; height: 54px; padding: 0 6px 0 18px; border-radius: 999px;
  background: var(--surface); box-shadow: 0 0 0 .5px var(--sep), var(--shadow-2);
  transition: box-shadow .25s var(--ease-out);
}
.field:focus-within { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent), var(--shadow-2); }
.field .lead { width: 19px; height: 19px; color: var(--label-3); margin-right: 6px; }
.field input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 1.0625rem; -webkit-appearance: none; appearance: none; }
.field input::-webkit-search-cancel-button { display: none; }
.field input::placeholder { color: var(--label-3); }
.field-sep { width: 1px; height: 22px; background: var(--sep); margin: 0 2px; }
.field .go { color: var(--accent); }
.field-wrap.md .field { height: 46px; box-shadow: 0 0 0 .5px var(--sep); background: var(--surface); }
.field-wrap.md .field:focus-within { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 70%, transparent); }
.field-wrap.md .icon-btn { width: 34px; height: 34px; }
.listening .field { box-shadow: 0 0 0 2px var(--red), var(--shadow-2) !important; }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 40; margin: 0; padding: 6px; list-style: none;
  border-radius: var(--radius-xl); background: var(--material-thick); transform-origin: top center; animation: pop .2s var(--ease-out);
  max-height: 70vh; overflow: auto;
}
@keyframes pop { from { opacity: 0; transform: scale(.98) translateY(-4px); } }
.suggest li { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: var(--radius-md); cursor: pointer; }
.suggest li .i { width: 17px; height: 17px; color: var(--label-3); }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--fill-2); }
.suggest .sug { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .sug b { font-weight: 600; }
.suggest li.history .sug { color: var(--visited); }
.suggest .remove { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--label-3); }
.suggest .remove:hover { background: var(--fill-1); }
.suggest .hd { min-height: 30px; font-size: var(--text-caption); font-weight: 600; color: var(--label-3); cursor: default; text-transform: uppercase; letter-spacing: .05em; }
.suggest .hd:hover { background: none; }

/* ---------- popovers ---------- */
.pop-wrap { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; border-radius: var(--radius-xl); background: var(--material-thick); padding: 8px; min-width: 240px; animation: pop .2s var(--ease-out); }
.apps-pop { width: 312px; padding: 12px; }
.apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.app { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: var(--radius-md); color: var(--label); font-size: var(--text-caption); text-decoration: none !important; }
.app:hover { background: var(--fill-2); }
.app-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--app); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), var(--shadow-1); }
.app-icon .i { width: 21px; height: 21px; }
.apps-more { display: block; text-align: center; margin-top: 8px; padding: 10px; border-radius: var(--radius-md); font-size: var(--text-footnote); background: var(--fill-3); }
.avatar-btn { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--sep); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-pop { width: 290px; }
.account-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; border-bottom: .5px solid var(--sep); margin-bottom: 6px; }
.account-head img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.account-head div { min-width: 0; }
.account-head strong { display: block; font-size: var(--text-subhead); }
.account-head span { display: block; font-size: var(--text-footnote); color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popover a[role="menuitem"], .popover button[role="menuitem"] {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 10px; border-radius: var(--radius-md);
  color: var(--label); font-size: var(--text-subhead); text-decoration: none !important; text-align: left;
}
.popover a[role="menuitem"]:hover, .popover button[role="menuitem"]:hover { background: var(--fill-2); }
.popover [role="menuitem"] .i { color: var(--label-3); width: 18px; height: 18px; }
.popover .danger { color: var(--red); }
.menu-pop { min-width: 220px; }

/* ---------- home ---------- */
.home-top { display: flex; justify-content: space-between; align-items: center; padding: 14px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.home-links { display: flex; gap: 18px; font-size: var(--text-footnote); }
.home-links a { color: var(--label-2); }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.home { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 11vh max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; align-items: center; gap: 26px; }
.home-brand { display: flex; align-items: center; gap: 14px; margin: 0; font-size: clamp(2.4rem, 5vw + 1rem, 3.3rem); font-weight: 600; letter-spacing: var(--tracking-tight); line-height: 1; color: var(--label); text-decoration: none !important; }
.home-brand b { font-weight: 600; color: var(--accent); }
.home-brand.sm { font-size: 2rem; }
.home-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.home-section { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.section-hd { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-hd h2 { margin: 0; font-size: var(--text-footnote); font-weight: 600; color: var(--label-2); }
.home-apps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; width: 100%; margin-top: 6px; }
.home-app { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 2px; border-radius: var(--radius-lg); font-size: var(--text-caption); color: var(--label-2); text-decoration: none !important; transition: background .2s; }
.home-app:hover { background: var(--fill-3); color: var(--label); }
.home-app .app-icon { width: 48px; height: 48px; border-radius: 14px; }
.home-privacy { text-align: center; font-size: var(--text-footnote); color: var(--label-3); margin: 4px 0 0; text-wrap: balance; }
.home-privacy .i { color: var(--green); width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 30; border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  padding: 12px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  padding-top: max(12px, env(safe-area-inset-top));
}
.toolbar.slim { padding-bottom: 12px; }
.tb-row { max-width: var(--wrap); margin: 0 auto; display: flex; align-items: center; gap: 18px; }
.tb-brand { min-width: calc(var(--lead) - 18px); display: flex; align-items: center; gap: 9px; font-size: var(--text-headline); font-weight: 600; letter-spacing: var(--tracking-snug); color: var(--label); text-decoration: none !important; flex: none; }
.tb-brand b { font-weight: 600; color: var(--accent); }
.toolbar .field-wrap { flex: 1; min-width: 0; max-width: 860px; }
.toolbar .top-actions { margin-left: auto; }
.tb-tabs { max-width: var(--wrap); margin: 8px auto 0; display: flex; align-items: center; gap: 12px; padding-left: var(--lead); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px 12px; font-size: var(--text-footnote); font-weight: 500; color: var(--label-2); white-space: nowrap; text-decoration: none !important; }
.tab .i { width: 15px; height: 15px; }
.tab:hover { color: var(--label); }
.tab.on { color: var(--label); font-weight: 600; }
.tab.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.tab-ai .i { color: var(--accent); }
.tools-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 8px 12px; border-radius: 999px; font-size: var(--text-footnote); color: var(--label-2); flex: none; }
.tools-btn:hover, .tools-btn[aria-expanded="true"] { background: var(--fill-2); color: var(--label); }
.tools-btn .i { width: 15px; height: 15px; }
.tools { max-width: var(--wrap); margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 4px 0 12px var(--lead); }
.select { position: relative; display: inline-flex; align-items: center; }
.select select { -webkit-appearance: none; appearance: none; min-height: 34px; padding: 0 32px 0 14px; border-radius: 999px; border: 0; background: var(--fill-2); font-size: var(--text-footnote); font-weight: 500; cursor: pointer; }
.select .i { position: absolute; right: 10px; width: 14px; height: 14px; pointer-events: none; color: var(--label-3); }

/* ---------- results layout ---------- */
.page { flex: 1; width: 100%; max-width: calc(var(--wrap) + 32px); margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-right)) 56px max(16px, env(safe-area-inset-left)); display: grid; grid-template-columns: minmax(0, 860px) minmax(320px, 1fr); justify-content: start; column-gap: 48px; align-items: start; padding-left: calc(max(16px, env(safe-area-inset-left)) + var(--lead)); }
.side-col { max-width: 500px; }
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 26px; }
.side-col { min-width: 0; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 150px; }
.page-results.tab-images .page, .page-results.tab-videos .page, .page-results.tab-places .page, .page-results.tab-news .page { grid-template-columns: minmax(0, 1fr); padding-right: max(16px, env(safe-area-inset-right)); }
.page-results.tab-images .side-col, .page-results.tab-videos .side-col, .page-results.tab-places .side-col, .page-results.tab-news .side-col { display: none; }
.card { background: var(--surface); border-radius: var(--radius-xl); box-shadow: 0 0 0 .5px var(--sep), var(--shadow-1); }
.meta-line { font-size: var(--text-footnote); color: var(--label-3); margin-top: -12px; }
.block-hd { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: var(--text-title-3); font-weight: 600; letter-spacing: var(--tracking-snug); }
.block-hd .i { color: var(--label-3); width: 18px; height: 18px; }

.notice { padding: 14px 16px; border-radius: var(--radius-lg); background: var(--fill-3); font-size: var(--text-subhead); color: var(--label-2); }
.notice a { font-weight: 600; }
.spell { font-size: var(--text-body); }
.spell em { font-style: italic; font-weight: 600; }
.spell .sub { display: block; font-size: var(--text-footnote); color: var(--label-3); margin-top: 2px; }

/* skeleton */
.skeleton { display: flex; flex-direction: column; gap: 10px; }
.sk-card { height: 140px; border-radius: var(--radius-xl); }
.sk-line { height: 13px; border-radius: 7px; }
.sk-card, .sk-line { background: linear-gradient(90deg, var(--fill-3), var(--fill-2), var(--fill-3)); background-size: 200% 100%; animation: sh 1.3s linear infinite; }
.sk-line.gap { margin-top: 18px; }
.w40 { width: 40%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; } .w90 { width: 90%; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- web result ---------- */
.result { position: relative; display: flex; flex-direction: column; gap: 3px; }
.r-site { display: flex; align-items: center; gap: 10px; min-width: 0; padding-right: 36px; }
.fav { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-2); box-shadow: 0 0 0 .5px var(--sep); overflow: hidden; font-size: .78rem; font-weight: 700; color: var(--label-2); }
.fav img { width: 18px; height: 18px; object-fit: contain; }
.r-site .who { min-width: 0; line-height: 1.25; }
.r-site .name { font-size: var(--text-subhead); color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-site .url { font-size: var(--text-caption); color: var(--label-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result h3 { margin: 6px 0 0; font-size: var(--text-title-3); font-weight: 500; letter-spacing: var(--tracking-snug); line-height: 1.28; }
.result h3 a:visited { color: var(--visited); }
.result p.snip { margin: 1px 0 0; font-size: var(--text-subhead); color: var(--label-2); line-height: 1.55; overflow-wrap: anywhere; }
.snip .date { color: var(--label-3); }
.snip mark, .child mark { background: none; color: var(--label); font-weight: 600; }
.r-body { display: flex; gap: 16px; }
.r-body > div { flex: 1; min-width: 0; }
.r-thumb { width: 92px; height: 92px; border-radius: var(--radius-md); object-fit: cover; flex: none; margin-top: 6px; background: var(--fill-3); }
.sitelinks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sitelinks a { font-size: var(--text-footnote); padding: 6px 12px; border-radius: 999px; background: var(--fill-3); color: var(--link); text-decoration: none !important; }
.sitelinks a:hover { background: var(--fill-2); }
.child { margin: 10px 0 0 38px; padding-left: 14px; border-left: 2px solid var(--sep); }
.child a { font-size: var(--text-headline); }
.child p { margin: 2px 0 0; font-size: var(--text-footnote); color: var(--label-2); }
.r-more { position: absolute; right: -6px; top: -2px; }
.r-more .icon-btn { width: 32px; height: 32px; color: var(--label-3); }
.r-more .popover { min-width: 230px; }

/* ---------- CruxAI Overview ---------- */
.overview { position: relative; padding: 18px 20px 14px; border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow-2); }
.overview::before {
  content: ""; position: absolute; inset: -1.5px; border-radius: calc(var(--radius-xl) + 1.5px); padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--ang, 0deg), var(--glow-a), var(--glow-b), var(--glow-c), var(--glow-a));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 3.5s linear infinite;
}
.overview.done::before { animation-duration: 24s; opacity: .55; }
.overview.error::before { display: none; }
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --ang: 360deg; } }
.ov-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ai-orb { width: 28px; height: 28px; border-radius: 9px; flex: none; display: grid; place-items: center; background: conic-gradient(from 210deg, #327491, #4b9cbf, #b7802b, #327491); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 14px rgba(50,116,145,.35); }
.ai-orb .crux-mark { width: 16px; height: 15px; color: #fff; }
.ai-orb.lg { width: 64px; height: 64px; border-radius: 20px; }
.ai-orb.lg .crux-mark { width: 34px; height: 31px; }
.overview:not(.done) .ai-orb, .ai-msg.streaming .ai-orb { animation: breathe 1.3s var(--ease-out) infinite alternate; }
@keyframes breathe { to { transform: scale(1.08); } }
.ov-hd .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ov-hd strong { font-size: var(--text-subhead); font-weight: 600; }
.ov-hd .status { font-size: var(--text-caption); color: var(--label-3); }
.ov-body { font-size: var(--text-body); line-height: 1.6; max-width: 78ch; position: relative; max-height: 11.2em; overflow: hidden; }
.ov-body.writing.overflowing { -webkit-mask-image: linear-gradient(transparent, #000 2.4em); mask-image: linear-gradient(transparent, #000 2.4em); }
.ov-body.done.overflowing { -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
/* The window keeps its full height while writing, so nothing below it moves. */
.ov-body.writing { height: 11.2em; }
.ov-body.writing.expanded { height: auto; }
.ov-body.expanded { max-height: none; -webkit-mask-image: none !important; mask-image: none !important; }
.ov-toggle { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 12px; border-radius: 999px; background: var(--fill-3); font-size: var(--text-footnote); font-weight: 500; color: var(--label); }
.ov-toggle:hover { background: var(--fill-2); }
.ov-toggle .i { width: 15px; height: 15px; transition: transform .25s var(--ease-out); }
.ov-toggle[aria-expanded="true"] .i { transform: rotate(180deg); }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 1.3em; }
.md li { margin: 4px 0; }
.md h2, .md h3 { font-size: var(--text-headline); font-weight: 600; margin: 18px 0 6px; letter-spacing: var(--tracking-snug); }
.md code { font-family: var(--font-mono); font-size: .88em; padding: 1px 5px; border-radius: 5px; background: var(--fill-2); }
.md pre { overflow-x: auto; padding: 12px 14px; border-radius: var(--radius-md); background: var(--fill-3); font-size: var(--text-footnote); }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; font-size: var(--text-subhead); margin: 6px 0 12px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border-bottom: .5px solid var(--sep); padding: 7px 12px 7px 0; text-align: left; vertical-align: top; }
.md th { font-weight: 600; }
.md > :last-child { margin-bottom: 0; }
.cite { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin-left: 3px; border-radius: 6px; background: var(--fill-2); font-size: .6875rem; font-weight: 600; color: var(--label-2); vertical-align: 2px; text-decoration: none !important; line-height: 1; font-variant-numeric: tabular-nums; }
.cite:hover { background: var(--accent-soft); color: var(--accent-strong); }
.caret { display: inline-block; width: 7px; height: 1em; vertical-align: -2px; margin-left: 2px; border-radius: 2px; background: linear-gradient(var(--glow-a), var(--glow-b)); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.shimmer { height: 12px; border-radius: 6px; margin: 10px 0; background: linear-gradient(90deg, var(--fill-3), var(--fill-1), var(--fill-3)); background-size: 200% 100%; animation: sh 1.2s linear infinite; }
.sources { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-top: 12px; padding-bottom: 2px; }
.sources::-webkit-scrollbar { display: none; }
.src { display: inline-flex; align-items: center; gap: 7px; flex: none; max-width: 240px; min-height: 32px; padding: 0 11px 0 4px; border-radius: 999px; background: var(--fill-3); font-size: var(--text-footnote); color: var(--label); text-decoration: none !important; }
.src:hover { background: var(--fill-2); }
.src .fav { width: 24px; height: 24px; }
.src .fav img { width: 15px; height: 15px; }
.src span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src .n { color: var(--label-3); font-variant-numeric: tabular-nums; }
.ov-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: .5px solid var(--sep); }
.ov-foot .note { flex: 1; font-size: var(--text-caption); color: var(--label-3); }
.ov-foot .icon-btn { width: 32px; height: 32px; }
.ov-foot .icon-btn .i { width: 16px; height: 16px; }
.ov-foot .icon-btn[aria-pressed="true"] { color: var(--accent); }
.ov-dive { margin-left: 4px; }
.fade-in { animation: fi .3s var(--ease-out) both; }
@keyframes fi { from { opacity: 0; transform: translateY(5px); } }

/* ---------- answers ---------- */
.answer { padding: 18px 20px; }
.answer .src-line { margin-top: 12px; font-size: var(--text-caption); color: var(--label-3); }
.answer .src-line a { color: var(--label-3); text-decoration: underline; }
.calc .expr { font-size: var(--text-subhead); color: var(--label-2); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.calc .res { font-size: 2.6rem; font-weight: 300; letter-spacing: -.02em; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.15; }
.calc .keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 14px; }
.calc .keys button { min-height: 42px; border-radius: 12px; background: var(--fill-3); font-size: var(--text-headline); font-variant-numeric: tabular-nums; transition: transform .1s, background .2s; }
.calc .keys button:hover { background: var(--fill-2); }
.calc .keys button:active { transform: scale(.95); }
.calc .keys .op { color: var(--accent-strong); font-weight: 600; }
.calc .keys .eq { background: var(--accent); color: var(--on-accent); }
.conv { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.conv label { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-footnote); color: var(--label-2); min-width: 0; }
.conv input, .conv select { width: 100%; min-height: 44px; padding: 0 12px; border-radius: var(--radius-md); border: 0; background: var(--fill-3); font-size: var(--text-title-3); font-variant-numeric: tabular-nums; }
.conv select { font-size: var(--text-subhead); -webkit-appearance: none; appearance: none; min-height: 36px; }
.conv .eqs { padding-bottom: 54px; color: var(--label-3); font-size: var(--text-title-3); }
.big-number { font-size: 2.4rem; font-weight: 300; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big-number small { font-size: var(--text-headline); color: var(--label-2); font-weight: 500; letter-spacing: 0; }
.sub { font-size: var(--text-subhead); color: var(--label-2); }
.weather { background: linear-gradient(175deg, #2f6e92, #6ea6c8); color: #fff; padding: 18px 20px; border-radius: var(--radius-xl); }
.weather.night { background: linear-gradient(175deg, #1c2e45, #3b5677); }
.weather.rainy { background: linear-gradient(175deg, #4a5d6e, #7d93a6); }
.weather .w-top { display: flex; justify-content: space-between; gap: 12px; }
.weather .w-place { font-size: var(--text-headline); font-weight: 600; }
.weather .w-temp { font-size: 3.6rem; font-weight: 300; letter-spacing: -.03em; line-height: 1; margin-top: 4px; }
.weather .w-cond { text-align: right; font-size: var(--text-subhead); font-weight: 500; }
.weather .w-cond .i { width: 34px; height: 34px; margin-bottom: 4px; }
.weather .w-cond div:not(:first-child) { opacity: .85; }
.weather .w-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(52px, 1fr); gap: 4px; margin-top: 14px; padding-top: 12px; border-top: .5px solid rgba(255,255,255,.3); overflow-x: auto; text-align: center; font-size: var(--text-footnote); font-weight: 500; font-variant-numeric: tabular-nums; scrollbar-width: none; }
.weather .w-strip .i { width: 20px; height: 20px; margin: 5px auto; display: block; }
.weather .w-strip b { display: block; font-weight: 600; }
.weather .w-days { margin-top: 10px; display: grid; gap: 2px; font-size: var(--text-subhead); font-variant-numeric: tabular-nums; }
.weather .w-day { display: grid; grid-template-columns: 56px 26px 1fr 90px; align-items: center; gap: 8px; padding: 5px 0; border-top: .5px solid rgba(255,255,255,.18); }
.weather .w-day .i { width: 20px; height: 20px; }
.weather .w-day .r { text-align: right; }
.weather .w-day .rain { font-size: var(--text-caption); opacity: .8; }
.weather .src-line, .weather .src-line a { color: rgba(255,255,255,.75); }
.define .word { font-size: 2rem; font-weight: 600; letter-spacing: var(--tracking-tight); display: flex; align-items: center; gap: 10px; }
.define .phon { color: var(--label-2); font-size: var(--text-subhead); }
.define .pos { margin: 14px 0 4px; font-style: italic; color: var(--label-2); font-size: var(--text-subhead); }
.define ol { margin: 0; padding-left: 1.3em; }
.define li { margin: 6px 0; }
.define .ex { display: block; color: var(--label-3); font-size: var(--text-subhead); margin-top: 2px; }
.define .syn { margin-top: 6px; font-size: var(--text-footnote); color: var(--label-2); }
.timer-face { font-size: 3.4rem; font-weight: 300; letter-spacing: -.02em; font-variant-numeric: tabular-nums; text-align: center; }
.row-btns { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.swatch { width: 100%; height: 96px; border-radius: var(--radius-lg); box-shadow: inset 0 0 0 .5px var(--sep); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin-top: 12px; font-size: var(--text-subhead); font-variant-numeric: tabular-nums; }
.kv dt { color: var(--label-2); }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: var(--text-footnote); align-self: center; }

/* ---------- Crux & personal ---------- */
.crux-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.crux-card .r-site .fav { background: var(--app); color: #fff; box-shadow: none; }
.crux-card .badge { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-caption); font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }
.crux-card .badge .i { width: 12px; height: 12px; }
.personal { padding: 14px 16px; }
.personal .block-hd { font-size: var(--text-subhead); margin-bottom: 6px; }
.personal .block-hd .i { color: var(--accent); }
.personal .lock { margin-left: auto; font-size: var(--text-caption); color: var(--label-3); font-weight: 400; display: inline-flex; gap: 4px; align-items: center; }
.personal .lock .i { width: 12px; height: 12px; }
.p-item { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-top: .5px solid var(--sep); color: var(--label); text-decoration: none !important; }
.p-item:first-of-type { border-top: 0; }
.p-item:hover .p-title { text-decoration: underline; }
.p-item .app-icon { width: 32px; height: 32px; border-radius: 9px; }
.p-item .app-icon .i { width: 16px; height: 16px; }
.p-item div { min-width: 0; }
.p-title { font-size: var(--text-subhead); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-meta { font-size: var(--text-caption); color: var(--label-3); }

/* ---------- carousels: news, videos ---------- */
.carousel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; scrollbar-width: thin; }
.story { scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 0 0 .5px var(--sep), var(--shadow-1); color: var(--label); text-decoration: none !important; min-width: 0; }
.story:hover { box-shadow: 0 0 0 .5px var(--sep-strong), var(--shadow-2); }
.story img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-md); background: var(--fill-3); }
.story .s-src { display: flex; align-items: center; gap: 7px; font-size: var(--text-caption); color: var(--label-2); min-width: 0; }
.story .s-src .fav { width: 18px; height: 18px; }
.story .s-src .fav img { width: 12px; height: 12px; }
.story .s-src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story .s-title { font-size: var(--text-subhead); font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story .s-age { font-size: var(--text-caption); color: var(--label-3); margin-top: auto; }
.vthumb { position: relative; }
.vthumb .dur { position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.72); color: #fff; font-size: var(--text-caption); font-weight: 600; font-variant-numeric: tabular-nums; }
.vthumb .play { position: absolute; inset: 0; display: grid; place-items: center; }
.vthumb .play span { width: 40px; height: 40px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.vthumb .play .i { color: #fff; fill: #fff; width: 16px; height: 16px; }

/* ---------- related questions ---------- */
.paa { overflow: hidden; }
.paa h2 { margin: 0; padding: 16px 18px 6px; font-size: var(--text-headline); font-weight: 600; }
.paa details { border-top: .5px solid var(--sep); margin-left: 18px; }
.paa details:first-of-type { border-top: 0; }
.paa summary { list-style: none; min-height: 48px; padding: 11px 18px 11px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-size: var(--text-body); }
.paa summary::-webkit-details-marker { display: none; }
.paa summary .i { width: 16px; height: 16px; color: var(--label-3); transition: transform .25s var(--ease-out); flex: none; }
.paa details[open] summary .i { transform: rotate(180deg); }
.paa .ans { padding: 0 18px 14px 0; font-size: var(--text-subhead); color: var(--label-2); line-height: 1.55; }
.paa .ans .src-row { margin-top: 8px; font-size: var(--text-caption); }

/* ---------- related searches, pagination ---------- */
.related { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.related a { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 999px; background: var(--fill-3); color: var(--label); font-size: var(--text-subhead); text-decoration: none !important; min-width: 0; }
.related a:hover { background: var(--fill-2); }
.related a .i { color: var(--label-3); width: 16px; height: 16px; }
.related a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pager a, .pager span { min-width: 38px; height: 38px; padding: 0 12px; border-radius: 999px; display: inline-grid; place-items: center; font-size: var(--text-subhead); font-variant-numeric: tabular-nums; text-decoration: none !important; }
.pager a { color: var(--label); background: var(--fill-3); }
.pager a:hover { background: var(--fill-2); }
.pager .cur { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.pager .next { display: inline-flex; gap: 4px; padding: 0 16px; }
.attribution { font-size: var(--text-caption); color: var(--label-3); text-align: center; }
.attribution a { color: var(--label-3); text-decoration: underline; }

/* ---------- knowledge panel ---------- */
.kp { overflow: hidden; }
.kp-img { width: 100%; max-height: 240px; object-fit: cover; display: block; background: var(--fill-3); }
.kp-body { padding: 16px 18px 18px; }
.kp-body h2 { margin: 0; font-size: var(--text-title-2); font-weight: 700; letter-spacing: var(--tracking-snug); text-wrap: balance; }
.kp-body .sub { margin-top: 2px; font-size: var(--text-subhead); color: var(--label-2); }
.kp-body .kp-text { margin: 12px 0 0; font-size: var(--text-subhead); line-height: 1.55; }
.kp-body .kp-text a { font-size: var(--text-footnote); }
.facts { margin: 14px 0 0; border-top: .5px solid var(--sep); }
.facts div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: .5px solid var(--sep); font-size: var(--text-subhead); }
.facts dt { color: var(--label-2); flex: none; }
.facts dd { margin: 0; text-align: right; }
.kp-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* ---------- images grid ---------- */
.img-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.img-grid a { flex-grow: 1; position: relative; height: 180px; border-radius: var(--radius-md); overflow: hidden; background: var(--fill-3); text-decoration: none !important; }
.img-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s var(--ease-out); }
.img-grid a:hover img { transform: scale(1.03); }
.img-grid .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 6px; font-size: var(--text-caption); color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity .2s; }
.img-grid a:hover .cap, .img-grid a:focus-visible .cap { opacity: 1; }
.viewer { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-columns: minmax(0, 1fr) 340px; background: rgba(8, 12, 15, .82); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); animation: fi .2s var(--ease-out); }
.viewer .stage { display: grid; place-items: center; padding: 24px; min-width: 0; }
.viewer .stage img { max-height: 86vh; max-width: 100%; border-radius: var(--radius-md); box-shadow: var(--shadow-float); }
.viewer .info { background: var(--surface); color: var(--label); padding: 20px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.viewer .info h2 { margin: 0; font-size: var(--text-headline); }
.viewer .close { position: absolute; top: 14px; left: 14px; background: var(--material-thick); color: var(--label); }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); background: var(--material-thick); color: var(--label); }
.viewer .nav.prev { left: 14px; } .viewer .nav.nx { right: 354px; }
.viewer .nav.prev .i { transform: rotate(180deg); }

/* video list */
.vlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 26px 20px; }
.vrow { display: flex; flex-direction: column; gap: 10px; color: var(--label); text-decoration: none !important; min-width: 0; }
.vrow img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-md); background: var(--fill-3); }
.vrow h3 { margin: 0 0 4px; font-size: var(--text-headline); font-weight: 500; color: var(--link); }
.vrow:hover h3 { text-decoration: underline; }
.vrow p { margin: 4px 0 0; font-size: var(--text-footnote); color: var(--label-2); }
.news-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 560px), 1fr)); gap: 22px 40px; }
.news-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 16px; align-items: start; }
.news-row img { width: 120px; height: 84px; object-fit: cover; border-radius: var(--radius-md); }

/* places */
.places { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; }
.place-list { display: flex; flex-direction: column; gap: 8px; }
.place { text-align: left; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 0 0 .5px var(--sep); }
.place.on { box-shadow: 0 0 0 2px var(--accent); }
.place strong { display: block; font-size: var(--text-headline); }
.place span { font-size: var(--text-footnote); color: var(--label-2); }
.map-frame { width: 100%; height: 480px; border: 0; border-radius: var(--radius-xl); background: var(--fill-3); }
.map-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- AI Mode ---------- */
.page-ai { height: 100dvh; overflow: hidden; }
.ai-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: var(--text-footnote); font-weight: 600; }
.ai-badge .i { width: 14px; height: 14px; }
.ai-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.threads { padding: 18px 12px; border-right: .5px solid var(--sep); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.threads-hd { font-size: var(--text-caption); text-transform: uppercase; letter-spacing: .05em; color: var(--label-3); margin: 12px 8px 2px; font-weight: 600; }
.new-thread { justify-content: flex-start; }
.thread-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.thread-list li { display: flex; align-items: center; border-radius: var(--radius-md); }
.thread-list li.on, .thread-list li:hover { background: var(--fill-2); }
.thread-list a { flex: 1; min-width: 0; padding: 9px 10px; font-size: var(--text-subhead); color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none !important; }
.thread-list .icon-btn { width: 30px; height: 30px; opacity: 0; }
.thread-list li:hover .icon-btn, .thread-list .icon-btn:focus-visible { opacity: 1; }
.thread-list .icon-btn .i { width: 15px; height: 15px; }
.ai-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.ai-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 28px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
.ai-empty { max-width: 640px; margin: 8vh auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ai-empty h1, .ai-signin h1 { margin: 6px 0 0; font-size: var(--text-large-title); font-weight: 700; letter-spacing: var(--tracking-tight); }
.ai-empty p, .ai-signin p { margin: 0; color: var(--label-2); max-width: 46ch; }
.ai-signin { max-width: 560px; margin: 12vh auto; padding: 0 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ai-signin .footnote { font-size: var(--text-footnote); color: var(--label-3); }
.ai-thread { max-width: 920px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.q-bubble { align-self: flex-end; max-width: 80%; padding: 11px 16px; border-radius: 20px 20px 6px 20px; background: var(--accent-soft); font-size: var(--text-body); overflow-wrap: anywhere; white-space: pre-wrap; }
.ai-msg { display: flex; flex-direction: column; gap: 10px; }
.ai-msg .ov-hd { margin: 0; }
.ai-msg .md { font-size: var(--text-body); line-height: 1.65; }
.ai-status { font-size: var(--text-footnote); color: var(--label-3); display: flex; align-items: center; gap: 8px; }
.ai-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: blink 1s steps(2) infinite; }
.ai-msg.done .ai-status { display: none; }
.ai-actions { display: flex; gap: 2px; }
.ai-actions .icon-btn { width: 32px; height: 32px; }
.ai-actions .icon-btn .i { width: 16px; height: 16px; }
.composer { width: min(920px, calc(100% - 32px)); margin: 0 auto 8px; display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 18px; border-radius: 26px; }
.composer textarea { flex: 1; min-width: 0; border: 0; background: none; outline: none; resize: none; padding: 9px 0; max-height: 180px; font-size: var(--text-body); line-height: 1.4; }
.composer .send { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); transition: transform .1s, opacity .2s; flex: none; }
.composer .send:active { transform: scale(.92); }
.composer .send:disabled { opacity: .4; cursor: default; }
.composer .send .i { width: 19px; height: 19px; stroke-width: 2.4; }
.composer-note { text-align: center; font-size: var(--text-caption); color: var(--label-3); margin: 0 0 max(10px, env(safe-area-inset-bottom)); }

/* ---------- docs (settings, history, about) ---------- */
.doc { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 32px max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left)); }
.doc h1 { margin: 0 0 6px; font-size: var(--text-large-title); font-weight: 700; letter-spacing: var(--tracking-tight); text-wrap: balance; }
.doc .lede { margin: 0 0 26px; color: var(--label-2); font-size: var(--text-headline); line-height: 1.5; }
.doc-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.center-doc { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding-top: 12vh; }
.faq { margin-bottom: 26px; }
.faq h2 { font-size: var(--text-title-3); margin: 0 0 6px; letter-spacing: var(--tracking-snug); }
.faq p { margin: 0 0 10px; color: var(--label-2); line-height: 1.6; max-width: 66ch; }
.doc.wide { max-width: 1180px; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 22px; align-items: start; }
.group.span { grid-column: 1 / -1; }
.sub-row { padding-left: 18px; }
.sub-row.off { opacity: .45; }
.group { background: var(--surface); border-radius: var(--radius-xl); box-shadow: 0 0 0 .5px var(--sep), var(--shadow-1); padding: 6px 18px; }
.group h2 { margin: 12px 0 2px; font-size: var(--text-caption); text-transform: uppercase; letter-spacing: .06em; color: var(--label-3); font-weight: 600; }
.group-note { margin: 6px 0 10px; font-size: var(--text-footnote); color: var(--label-2); }
.group-note .i { width: 14px; height: 14px; vertical-align: -2px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; padding: 10px 0; border-top: .5px solid var(--sep); }
.group h2 + .row { border-top: 0; }
.row strong { font-weight: 500; }
.row p { margin: 2px 0 0; font-size: var(--text-footnote); color: var(--label-2); max-width: 52ch; }
.segmented { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--fill-2); flex: none; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: 6px 14px; border-radius: 8px; font-size: var(--text-footnote); font-weight: 500; transition: background .25s var(--ease-spring), box-shadow .25s; }
.segmented input:checked + span { background: var(--surface); box-shadow: 0 3px 8px rgba(0,0,0,.1), 0 1px 1px rgba(0,0,0,.05); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.segmented input:disabled + span { opacity: .4; }
.switch { position: relative; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-1); transition: background .25s var(--ease-out); }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .3s var(--ease-spring); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden-sites { list-style: none; margin: 0; padding: 0; }
.hidden-sites li { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border-top: .5px solid var(--sep); font-size: var(--text-subhead); }
.add-site input { flex: 1; min-width: 0; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--fill-3); }
.history-list { display: flex; flex-direction: column; }
.h-day { margin: 18px 0 6px; font-size: var(--text-caption); text-transform: uppercase; letter-spacing: .06em; color: var(--label-3); font-weight: 600; }
.h-item { display: flex; align-items: center; gap: 12px; min-height: 48px; border-top: .5px solid var(--sep); }
.h-item time { width: 70px; flex: none; font-size: var(--text-footnote); color: var(--label-3); font-variant-numeric: tabular-nums; }
.h-item a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-item .tag { font-size: var(--text-caption); color: var(--label-3); }
.more-btn { margin: 18px auto 0; display: flex; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--label-2); }
.noscript { max-width: 640px; margin: 24px auto; padding: 16px; text-align: center; }

/* ---------- footer & toast ---------- */
.site-footer { border-top: .5px solid var(--sep); margin-top: auto; }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 22px; flex-wrap: wrap; font-size: var(--text-footnote); color: var(--label-3); }
.footer-brand { display: inline-flex; align-items: center; gap: 7px; color: var(--label-2); font-weight: 600; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer nav a { color: var(--label-2); }
.footer-copy { margin-left: auto; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 90; transform: translateX(-50%); padding: 11px 18px; border-radius: 999px; font-size: var(--text-subhead); font-weight: 500; animation: toast .35s var(--ease-spring); }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .page { padding-left: max(16px, env(safe-area-inset-left)); grid-template-columns: minmax(0, 1fr) 340px; column-gap: 32px; }
  .tb-tabs, .tools { padding-left: 0; }
  .tb-brand { min-width: 0; }
}
@media (max-width: 900px) {
  .page { grid-template-columns: minmax(0, 1fr); }
  .side-col { position: static; }
  .side-col:empty { display: none; }
  .tb-brand span { display: none; }
  .ai-layout { grid-template-columns: minmax(0, 1fr); }
  .threads { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); background: var(--surface); box-shadow: var(--shadow-float); transform: translateX(-105%); transition: transform .35s var(--ease-out); padding-top: max(18px, env(safe-area-inset-top)); }
  .threads.open { transform: none; }
  .viewer { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .viewer .nav.nx { right: 14px; }
  .places { grid-template-columns: minmax(0, 1fr); }
  .map-frame { height: 320px; }
}
@media (min-width: 901px) { [data-threads-toggle] { display: none; } }
@media (max-width: 640px) {
  .tb-row { flex-wrap: wrap; gap: 10px; }
  .page-results .toolbar .field-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .top-actions .btn-ai span { display: none; }
  .home { padding-top: 7vh; gap: 22px; }
  .home-apps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .related { grid-template-columns: minmax(0, 1fr); }
  .result h3 { font-size: var(--text-headline); }
  .r-thumb { width: 72px; height: 72px; }
  .child { margin-left: 18px; }
  .vrow { grid-template-columns: 140px minmax(0, 1fr); gap: 12px; }
  .news-row { grid-template-columns: minmax(0, 1fr) 88px; }
  .news-row img { width: 88px; height: 64px; }
  .img-grid a { height: 120px; }
  .footer-copy { margin-left: 0; }
  .weather .w-day { grid-template-columns: 48px 24px 1fr 80px; }
  .conv { grid-template-columns: minmax(0, 1fr); }
  .conv .eqs { display: none; }
  .apps-pop { width: min(312px, calc(100vw - 32px)); }
  .doc-hd { flex-wrap: wrap; }
  .row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- wide screens: secondary modules live in the side column ---------- */
.side-col .side-mod { display: flex; flex-direction: column; gap: 10px; }
.side-col .side-mod .block-hd { font-size: var(--text-headline); margin: 0; }
.side-col .carousel { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-columns: auto; overflow: visible; scroll-snap-type: none; }
.side-col .story { padding: 10px; }
.side-col .story .s-title { font-size: var(--text-footnote); -webkit-line-clamp: 3; }
.side-col .related { grid-template-columns: minmax(0, 1fr); }
.side-col .result { padding: 12px 14px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 0 0 .5px var(--sep); }
.side-col .result h3 { font-size: var(--text-headline); }
.side-col .result .r-more { display: none; }
@media (min-width: 1500px) {
  .result p.snip { font-size: var(--text-body); }
}
.overview .sources { min-height: 32px; }
@media (max-width: 640px) {
  .ov-foot { flex-wrap: wrap; }
  .ov-foot .note { flex-basis: 100%; }
  .ov-dive { margin-left: auto; }
}
