:root {
  color-scheme: light;
  --bg: #f8f7f4;
  --bg-solid: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f5f5f7;
  --surface-tint: #f4f2ff;
  --text: #1b1c22;
  --muted: #5c606b;
  --faint: #696d78;
  --line: #e5e5e8;
  --line-strong: #d6d7dc;
  --accent: #86609e;
  --accent-dark: #704a88;
  --accent-soft: rgba(134, 96, 158, 0.12);
  --berry: #d94d78;
  --link: #4051c7;
  --link-visited: #7650a8;
  --focus: #5546d4;
  --on-accent: #ffffff;
  --search-hover-border: #c8b3d2;
  --search-hover-icon: #9b82b4;
  --search-focus-ring: rgba(45, 47, 54, 0.18);
  --shadow: 0 18px 48px rgba(37, 31, 76, 0.11), 0 2px 10px rgba(37, 31, 76, 0.06);
  --content-left: clamp(96px, 10vw, 180px);
  --result-width: 680px;
  --layout-width: 1080px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17181d;
  --bg-solid: #1c1d23;
  --surface: #22232a;
  --surface-soft: #27282f;
  --surface-tint: #28253d;
  --text: #ececf0;
  --muted: #b0b1bb;
  --faint: #92949e;
  --line: #303138;
  --line-strong: #44454d;
  --accent: #978cff;
  --accent-dark: #bab2ff;
  --accent-soft: rgba(151, 140, 255, 0.14);
  --berry: #ff789e;
  --link: #bdc5ff;
  --link-visited: #d1aeea;
  --focus: #b9b1ff;
  --on-accent: #17181d;
  --search-hover-border: #806d90;
  --search-hover-icon: #cbb8dd;
  --search-focus-ring: rgba(236, 236, 240, 0.24);
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.32);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #17181d;
    --bg-solid: #1c1d23;
    --surface: #22232a;
    --surface-soft: #27282f;
    --surface-tint: #28253d;
    --text: #ececf0;
    --muted: #b0b1bb;
    --faint: #92949e;
    --line: #303138;
    --line-strong: #44454d;
    --accent: #978cff;
    --accent-dark: #bab2ff;
    --accent-soft: rgba(151, 140, 255, 0.14);
    --berry: #ff789e;
    --link: #bdc5ff;
    --link-visited: #d1aeea;
    --focus: #b9b1ff;
    --on-accent: #17181d;
    --search-hover-border: #806d90;
    --search-hover-icon: #cbb8dd;
    --search-focus-ring: rgba(236, 236, 240, 0.24);
    --shadow: 0 20px 54px rgba(0, 0, 0, 0.32);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  display: flex;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  flex-direction: column;
  color: var(--text);
  background:
    radial-gradient(circle at 11% 1%, rgba(98, 84, 223, 0.07), transparent 28rem),
    radial-gradient(circle at 89% 88%, rgba(217, 77, 120, 0.055), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.results-mode {
  background: var(--bg-solid);
}

button,
input,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.page-glow {
  position: fixed;
  z-index: -1;
  top: -13rem;
  left: 50%;
  width: 42rem;
  height: 27rem;
  background: linear-gradient(105deg, rgba(98, 84, 223, 0.1), rgba(217, 77, 120, 0.07));
  border-radius: 50%;
  filter: blur(78px);
  transform: translateX(-50%);
  transition: opacity 180ms ease;
  pointer-events: none;
}

body.results-mode .page-glow {
  opacity: 0;
}

.search-header {
  position: relative;
  z-index: 10;
}

.top-actions {
  position: absolute;
  z-index: 5;
  top: max(18px, env(safe-area-inset-top));
  right: max(22px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 12px;
}

.locale-label {
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
}

.icon-button {
  display: grid;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line-strong);
}

.icon-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.moon-icon,
:root[data-theme="dark"] .sun-icon {
  display: none;
}

:root[data-theme="dark"] .moon-icon {
  display: block;
}

.search-stage {
  display: flex;
  min-height: calc(100vh - 62px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px 13vh;
  transition: min-height 220ms ease, padding 220ms ease;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 42px;
}

.hero-brand h1 {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 36px);
  font-weight: 820;
  letter-spacing: -0.055em;
  line-height: 0.94;
}

.hero-brand h1,
.compact-brand span {
  background: linear-gradient(110deg, var(--accent-dark) 0%, var(--accent) 52%, var(--berry) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hero-brand p {
  margin: 7px 0 0 2px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 580;
  letter-spacing: 0.12em;
}

.search-row {
  width: min(100%, 680px);
}

.compact-brand {
  display: none;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-decoration: none;
}

.search-form {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 60px;
  align-items: center;
  padding: 6px 8px 6px 20px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transition: border-color 160ms ease, box-shadow 160ms ease, min-height 180ms ease;
}

.search-form:hover {
  border-color: var(--search-hover-border);
}

.search-form:hover .search-icon {
  stroke: var(--search-hover-icon);
}

.search-form:hover .search-submit {
  color: var(--search-hover-icon);
}

.search-form:focus-within {
  border-color: var(--line-strong);
  outline: 0;
  box-shadow: 0 0 0 3px var(--search-focus-ring);
}

.search-icon {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--faint);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-form input {
  min-width: 0;
  height: 48px;
  flex: 1;
  padding: 0 14px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 17px;
}

.search-form input::placeholder {
  color: var(--faint);
  opacity: 1;
}

.search-form input::-webkit-search-cancel-button {
  display: none;
}

.shortcut-hint {
  min-width: 27px;
  padding: 4px 8px;
  color: var(--faint);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.search-clear,
.search-submit {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.search-clear {
  color: var(--muted);
  background: transparent;
}

.search-clear:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.search-divider {
  width: 1px;
  height: 24px;
  flex: 0 0 auto;
  margin: 0 3px;
  background: var(--line);
}

.search-submit {
  color: var(--faint);
  background: transparent;
  transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.search-submit:hover {
  color: var(--text);
  background: var(--accent-soft);
  transform: scale(1.02);
}

.search-clear svg,
.search-submit svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.hero-note {
  margin: 19px 0 0;
  color: var(--faint);
  font-size: 15px;
}

body.results-mode .search-header {
  background: var(--bg-solid);
  border-bottom: 1px solid var(--line);
}

body.results-mode .search-stage {
  display: block;
  min-height: auto;
  padding: 18px 24px 11px;
}

body.results-mode .hero-brand,
body.results-mode .hero-note {
  display: none;
}

body.results-mode .search-row {
  display: grid;
  width: calc(100% - 48px);
  max-width: 1828px;
  grid-template-columns: calc(var(--content-left) - 48px) minmax(420px, var(--result-width)) 1fr;
  gap: 24px;
  align-items: center;
  margin: 0;
}

body.results-mode .compact-brand {
  display: flex;
}

body.results-mode .search-form {
  min-height: 52px;
  padding: 4px 6px 4px 17px;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: 0 5px 18px rgba(30, 29, 44, 0.07);
}

:root[data-theme="dark"] body.results-mode .search-form {
  box-shadow: none;
}

body.results-mode .search-form input {
  height: 42px;
  font-size: 16px;
}

body.results-mode .search-clear,
body.results-mode .search-submit {
  width: 36px;
  height: 36px;
}

body.results-mode .search-submit {
  color: var(--muted);
  background: transparent;
}

body.results-mode .search-submit:hover {
  color: var(--text);
  background: var(--surface-soft);
  filter: none;
}

.results-navigation {
  background: var(--bg-solid);
}

.results-navigation-inner {
  display: grid;
  width: calc(100% - 48px);
  max-width: 1828px;
  min-height: 46px;
  grid-template-columns: calc(var(--content-left) - 48px) minmax(420px, var(--result-width)) 1fr;
  gap: 24px;
  align-items: center;
  margin: 0 24px;
}

.type-tabs {
  display: flex;
  min-width: 0;
  grid-column: 2;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.type-tabs button {
  position: relative;
  height: 38px;
  max-width: 180px;
  flex: 0 0 auto;
  padding: 0 14px;
  color: var(--faint);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-tabs button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.type-tabs button[aria-pressed="true"] {
  color: var(--text);
  font-weight: 760;
}

.type-tabs button[aria-pressed="true"]::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2px;
  background: var(--accent);
  border-radius: 999px;
  content: "";
}

.filter-toggle {
  display: inline-flex;
  height: 36px;
  align-items: center;
  grid-column: 3;
  justify-self: start;
  gap: 7px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}

.filter-toggle:hover,
.filter-toggle[aria-expanded="true"] {
  color: var(--text);
  background: var(--surface-soft);
}

.filter-toggle svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.filter-panel {
  border-top: 1px solid var(--line);
}

.filters {
  display: flex;
  width: calc(100% - 48px);
  max-width: 1828px;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 24px;
  padding: 11px 0 12px calc(var(--content-left) - 24px);
}

.filters label span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.filters select {
  width: 180px;
  height: 38px;
  padding: 0 30px 0 11px;
  color: var(--muted);
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}

.clear-filters,
.state-action {
  height: 38px;
  padding: 0 13px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 720;
}

.search-main {
  width: min(calc(100% - var(--content-left) - 32px), var(--layout-width));
  flex: 1;
  margin-right: 32px;
  margin-left: var(--content-left);
}

.results-shell {
  padding: 24px 0 84px;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--result-width)) minmax(280px, 360px);
  gap: 40px;
  align-items: start;
}

.results-column {
  min-width: 0;
}

.results-toolbar {
  display: flex;
  min-height: 32px;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 0 12px 7px;
}

.results-toolbar h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 720;
}

.results-toolbar p {
  margin: 0;
  color: var(--faint);
  font-size: 15px;
  text-align: right;
}

.search-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.results-list {
  display: grid;
}

body[data-renderer="image"] .search-main,
body[data-renderer="video"] .search-main,
body[data-renderer="map"] .search-main {
  width: calc(100% - 48px);
  max-width: none;
  margin: 0 24px;
}

body[data-renderer="image"] .results-layout,
body[data-renderer="video"] .results-layout,
body[data-renderer="map"] .results-layout {
  grid-template-columns: minmax(0, 1fr);
}

.image-results-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px 12px;
  align-items: start;
}

.video-results-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-width: none;
  gap: 22px 14px;
  align-items: start;
}

.image-result-card,
.video-result-card {
  min-width: 0;
}

.media-result-link {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.media-frame {
  position: relative;
  display: grid;
  width: 100%;
  overflow: hidden;
  place-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  aspect-ratio: 4 / 3;
}

.image-result-card .media-frame {
  aspect-ratio: var(--image-ratio, 4 / 3);
}

.video-result-card .media-frame {
  aspect-ratio: 16 / 9;
}

.video-result-card .media-result-link {
  display: block;
  min-height: 0;
  padding: 0;
  border-radius: 12px;
  transition: background-color 150ms ease;
}

.video-result-card .media-result-link:hover,
.video-result-card .media-result-link:focus-visible {
  background: var(--surface-soft);
}

.video-result-card .media-frame {
  border: 0;
  border-radius: 10px;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 150ms ease, opacity 150ms ease, transform 180ms ease;
}

.media-result-link:hover .media-frame img {
  transform: scale(1.015);
}

.media-placeholder span {
  color: var(--faint);
  font-size: 30px;
  font-weight: 800;
}

.video-duration-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: grid;
  min-width: 34px;
  min-height: 24px;
  padding: 2px 6px;
  place-items: center;
  color: #fff;
  background: rgba(12, 12, 16, 0.86);
  border-radius: 5px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.video-duration-badge.is-play-only {
  min-width: 28px;
  border-radius: 999px;
}

.media-copy {
  padding: 9px 2px 0;
}

.media-source {
  display: block;
  overflow: hidden;
  color: var(--faint);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-source-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.media-source-row .media-source {
  min-width: 0;
}

.media-source-mark {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  color: var(--on-accent);
  background: var(--berry);
  border-radius: 6px;
  font-size: 15px;
  font-weight: 800;
}

.media-published-date {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 15px;
}

.video-result-card .media-copy {
  min-width: 0;
  padding: 9px 2px 0;
}

.video-result-card .media-copy h3 {
  margin-top: 5px;
}

.media-copy h3,
.map-result-card h3 {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body[data-thumbnail-mode="blur"] .media-frame img {
  filter: blur(18px);
  transform: scale(1.08);
}

body[data-thumbnail-mode="blur"] .media-result-link:focus .media-frame img,
body[data-thumbnail-mode="blur"] .media-result-link:hover .media-frame img {
  filter: blur(8px);
}

body[data-thumbnail-mode="hide"] .media-frame img {
  opacity: 0;
}

.map-view {
  display: grid;
  min-height: calc(100vh - 210px);
  grid-template-columns: minmax(300px, 420px) 1fr;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.map-results-list {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  border-right: 1px solid var(--line);
}

.map-result-card {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.map-result-card:focus {
  background: var(--accent-soft);
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.map-result-card a {
  color: var(--link);
  text-decoration: none;
}

.map-result-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.map-location-address,
.map-location-phone {
  display: flex;
  gap: 7px;
  align-items: flex-start;
}

.map-location-address::before {
  content: "⌖";
  color: var(--accent-dark);
}

.map-location-phone::before {
  content: "☎";
  color: var(--accent-dark);
}

.map-location-phone a {
  color: inherit;
}

.map-canvas {
  position: relative;
  min-height: calc(100vh - 210px);
  overflow: hidden;
  background: #dcebd8;
  touch-action: none;
}

.map-tiles,
.map-markers {
  position: absolute;
  inset: 0;
}

.map-tiles img {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
}

.map-marker {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: #fff;
  background: #d43e5b;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 12%;
  box-shadow: 0 4px 13px rgba(26, 23, 35, 0.25);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  transform: translate(-50%, -75%) rotate(-45deg);
}

.map-marker::first-line {
  transform: rotate(45deg);
}

.map-controls {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  display: grid;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(20, 20, 30, 0.14);
}

.map-controls button {
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 22px;
}

.map-controls button:last-child {
  border-bottom: 0;
}

.map-attribution {
  position: absolute;
  z-index: 3;
  right: 8px;
  bottom: 8px;
  min-height: 30px;
  padding: 4px 9px;
  color: #202124;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(20, 20, 30, 0.16);
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

.side-panel-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  padding: 0;
  background: rgba(14, 14, 20, 0.24);
  border: 0;
  backdrop-filter: blur(2px);
}

.side-panel {
  position: fixed;
  z-index: 41;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(calc(100% - 32px), 410px);
  padding: 22px;
  overflow-y: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(20, 18, 32, 0.24);
}

.side-panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.side-panel > header p {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.08em;
}

.side-panel h2 {
  margin: 0;
  font-size: 20px;
}

.panel-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  color: var(--muted);
  background: var(--surface-soft);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 26px;
}

.panel-intro {
  margin: 18px 0;
  padding: 17px;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 14px;
}

.panel-intro p {
  margin: 7px 0 0;
  font-size: 15px;
  line-height: 1.55;
}

.rerank-options,
.quick-settings-list {
  display: grid;
}

.rerank-row,
.quick-settings-list label {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.rerank-row strong,
.rerank-row small,
.quick-settings-list strong,
.quick-settings-list small {
  display: block;
}

.rerank-row small,
.quick-settings-list small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 15px;
}

.rerank-row select,
.quick-settings-list select {
  min-width: 112px;
  min-height: 44px;
  padding: 0 30px 0 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
}

.quick-settings-list label {
  min-height: 58px;
  padding: 9px 2px;
}

.quick-settings-list strong {
  font-size: 14px;
}

.quick-settings-list small {
  font-size: 13px;
}

.quick-settings-list select {
  min-height: 40px;
  font-size: 14px;
}

.panel-reset {
  width: 100%;
  min-height: 46px;
  margin-top: 20px;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 750;
}

.action-count {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
}

.attribution-dialog a {
  color: var(--link);
}

.result-card,
.sponsored-card {
  position: relative;
  padding: 18px 12px 21px;
  border: 1px solid transparent;
  border-radius: 16px;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.result-card:focus-within {
  background: var(--surface-soft);
  border-color: var(--line);
}

.result-source-link,
.result-source-static {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
}

.source-tile {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #252633, var(--accent));
  border: 1px solid color-mix(in srgb, #fff 18%, transparent);
  border-radius: 9px;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-copy {
  min-width: 0;
}

.source-name,
.source-path {
  display: block;
  max-width: 440px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 680;
  line-height: 17px;
}

.source-path {
  color: var(--faint);
  font-size: 13px;
  line-height: 16px;
}

.result-heading {
  margin: 0;
}

.result-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--link);
  font-size: 18px;
  font-weight: 520;
  letter-spacing: -0.012em;
  line-height: 1.35;
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

a.result-title:visited {
  color: var(--link-visited);
}

a.result-title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-description {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.58;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-details {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 8px;
  color: var(--faint);
  font-size: 13px;
  line-height: 18px;
}

.result-details span {
  display: inline-flex;
  max-width: 100%;
  overflow-wrap: anywhere;
  align-items: center;
}

.result-details span + span::before {
  margin: 0 7px;
  color: var(--line-strong);
  content: "•";
}

.mixed-video-module {
  margin: 14px 12px 24px;
  padding: 14px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.mixed-video-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mixed-video-header h2 { margin: 0; font-size: 15px; }
.mixed-video-header span { color: var(--faint); font-size: 13px; }

.mixed-video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mixed-video-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
}

.mixed-video-card:hover,
.mixed-video-card:focus-visible { border-color: var(--line-strong); }

.mixed-video-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--surface-strong);
  border-radius: 8px;
}

.mixed-video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mixed-video-copy { min-width: 0; }
.mixed-video-copy h3 { display: -webkit-box; margin: 3px 0; overflow: hidden; font-size: 13px; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mixed-video-source,
.mixed-video-date { display: block; overflow: hidden; color: var(--faint); font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }

.mixed-video-more {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  color: var(--link);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.related-questions-module {
  margin: 14px 12px 24px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.related-questions-module > h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.35;
}

.related-question-row {
  border-bottom: 1px solid var(--line);
}

.related-question-row:last-child { border-bottom: 0; }

.related-question-row > summary {
  display: flex;
  min-height: 52px;
  padding: 13px 4px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  list-style: none;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
  cursor: pointer;
}

.related-question-row > summary::-webkit-details-marker { display: none; }

.related-question-row > summary::after {
  flex: 0 0 auto;
  color: var(--faint);
  content: "⌄";
  font-size: 19px;
  line-height: 1;
  transition: transform 150ms ease;
}

.related-question-row[open] > summary::after { transform: rotate(180deg); }

.related-question-row > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 6px;
}

.related-question-answer {
  padding: 0 32px 15px 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.related-question-evidence { margin: 0 0 8px; }

.related-question-source {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  color: var(--link);
  font-weight: 700;
  text-underline-offset: 3px;
}

.related-question-source:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.sponsored-slot {
  margin-bottom: 4px;
}

.sponsored-card {
  margin: 0 0 8px;
  background: linear-gradient(120deg, var(--surface-tint), transparent);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}

.sponsored-label {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 3px 8px;
  color: var(--accent-dark);
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.07em;
}

.loading-card {
  padding: 22px 12px;
}

.loading-source {
  display: flex;
  align-items: center;
  gap: 10px;
}

.loading-tile {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  background: var(--line);
  border-radius: 9px;
}

.loading-copy {
  width: min(42%, 190px);
  flex: 0 1 auto;
}

.loading-line {
  height: 11px;
  margin: 8px 0;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.loading-line::after,
.loading-tile::after {
  display: block;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--surface), transparent);
  content: "";
  animation: loading 1.15s infinite linear;
}

.loading-line-short {
  width: 68%;
}

.loading-line-title {
  width: 62%;
  height: 18px;
  margin-top: 13px;
}

@keyframes loading {
  from { transform: translateX(-120%); }
  to { transform: translateX(250%); }
}

.empty-state {
  margin-top: 14px;
  padding: 56px 24px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 18px;
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  line-height: 1.65;
}

.empty-state .state-action {
  margin-top: 18px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 30px;
}

.pagination button {
  min-width: 104px;
  height: 42px;
  padding: 0 18px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.pagination span {
  color: var(--faint);
  font-size: 13px;
}

.results-insights {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 14px;
}

.insight-card,
.insight-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.insight-card {
  overflow: hidden;
}

.insight-header {
  padding: 22px 22px 17px;
}

.insight-eyebrow {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.insight-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.insight-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.insight-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.insight-stat {
  padding: 15px 20px;
}

.insight-stat + .insight-stat {
  border-left: 1px solid var(--line);
}

.insight-stat strong,
.insight-stat span {
  display: block;
}

.insight-stat strong {
  color: var(--text);
  font-size: 17px;
}

.insight-stat span {
  margin-top: 3px;
  color: var(--faint);
  font-size: 15px;
}

.insight-section {
  padding: 17px 20px 19px;
}

.insight-section + .insight-section {
  border-top: 1px solid var(--line);
}

.insight-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 730;
}

.facet-list {
  display: grid;
  gap: 10px;
}

.facet-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
}

.facet-row button {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  color: var(--link);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 15px;
  font-weight: 620;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facet-row button:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.facet-row button[aria-pressed="true"] {
  color: var(--accent-dark);
  font-weight: 760;
}

.facet-count {
  color: var(--faint);
  font-size: 15px;
}

.facet-row progress {
  width: 100%;
  height: 3px;
  grid-column: 1 / -1;
  overflow: hidden;
  appearance: none;
  background: var(--surface-soft);
  border: 0;
  border-radius: 999px;
}

.facet-row progress::-webkit-progress-bar {
  background: var(--surface-soft);
}

.facet-row progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), var(--berry));
  border-radius: 999px;
}

.facet-row progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent), var(--berry));
  border-radius: 999px;
}

.type-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.type-summary button {
  max-width: 100%;
  padding: 6px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.type-summary button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.type-summary button[aria-pressed="true"] {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  font-weight: 720;
}

.insight-note {
  padding: 17px 19px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.insight-note strong {
  color: var(--text);
}

.footer {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px max(26px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(26px, env(safe-area-inset-left));
  color: var(--faint);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.footer p {
  margin: 0;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 16px;
}

.footer button,
.footer a {
  padding: 4px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}

.footer button:hover,
.footer a:hover {
  color: var(--text);
}

.info-dialog {
  width: min(calc(100% - 32px), 460px);
  padding: 30px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.info-dialog::backdrop {
  background: rgba(13, 14, 19, 0.5);
  backdrop-filter: blur(5px);
}

.info-dialog h2 {
  margin: 0 38px 10px 0;
  font-size: 21px;
}

.info-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.offline-page {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.offline-main {
  width: min(100%, 470px);
}

.offline-card {
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.offline-card .hero-brand {
  margin-bottom: 20px;
}

.offline-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.offline-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  margin-top: 22px;
  padding: 0 15px;
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 11px;
  font-size: 15px;
  font-weight: 720;
  text-decoration: none;
}

.dialog-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: var(--accent-soft);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

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

@media (min-width: 2300px) {
  :root {
    --content-left: calc((100vw - var(--layout-width)) / 2);
  }
}

@media (max-width: 1160px) {
  .image-results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .video-results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compact-brand > span:last-child {
    display: none;
  }

  .results-layout {
    grid-template-columns: minmax(0, var(--result-width));
  }

  .results-insights {
    display: none;
  }

  .search-main {
    width: min(calc(100% - var(--content-left) - 28px), var(--result-width));
    margin-right: 28px;
  }
}

@media (max-width: 900px) {
  :root {
    --content-left: 72px;
  }

  .locale-label {
    display: none;
  }

  body.results-mode .search-stage {
    padding-right: 70px;
    padding-left: 16px;
  }

  body.results-mode .search-row {
    width: 100%;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 12px;
  }

  .compact-brand > span:last-child {
    display: none;
  }

  .results-navigation-inner {
    display: flex;
    width: 100%;
    gap: 8px;
    margin: 0;
    padding: 0 16px;
  }

  .type-tabs {
    flex: 1;
  }

  .filter-toggle {
    flex: 0 0 auto;
  }

  .filters {
    width: 100%;
    margin: 0;
    padding: 11px 16px 12px;
  }

  .search-main {
    width: min(calc(100% - 32px), var(--result-width));
    margin: 0 auto;
  }

  body[data-renderer="image"] .search-main,
  body[data-renderer="video"] .search-main,
  body[data-renderer="map"] .search-main {
    width: calc(100% - 24px);
    margin: 0 12px;
  }

  .map-view {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .map-canvas {
    min-height: 58vh;
    grid-row: 1;
  }

  .map-results-list {
    max-height: none;
    grid-row: 2;
    border-top: 1px solid var(--line);
    border-right: 0;
  }
}

@media (max-width: 720px) {
  .mixed-video-grid {
    grid-template-columns: 1fr;
  }

  .image-results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-actions {
    top: max(12px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .search-stage {
    min-height: calc(100vh - 90px);
    justify-content: flex-start;
    padding: 22vh 12px 80px;
  }

  .hero-brand {
    gap: 12px;
    margin-bottom: 22px;
  }


  .hero-brand h1 {
    font-size: 36px;
  }

  .hero-brand p {
    font-size: 15px;
  }

  .search-form {
    min-height: 58px;
    padding-left: 16px;
    border-radius: 20px;
  }

  .search-form input {
    height: 44px;
    padding: 0 11px;
    font-size: 16px;
  }

  .shortcut-hint {
    display: none;
  }

  .search-clear,
  .search-submit {
    width: 40px;
    height: 40px;
  }

  .hero-note {
    max-width: 300px;
    text-align: center;
  }

  body.results-mode .search-stage {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: 9px;
  }

  body.results-mode .search-form {
    min-height: 48px;
    border-radius: 17px;
  }

  body.results-mode .search-form input {
    height: 38px;
    font-size: 15px;
  }

  body.results-mode .search-clear,
  body.results-mode .search-submit {
    width: 34px;
    height: 34px;
  }

  body.results-mode .search-icon {
    display: none;
  }

  .filter-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .filters label {
    min-width: 0;
    flex: 1 1 130px;
  }

  .filters select {
    width: 100%;
  }

  .clear-filters {
    flex: 1 1 100%;
  }

  .results-shell {
    padding: 15px 0 64px;
  }

  .results-toolbar {
    padding: 0 4px 8px;
  }

  .results-toolbar h1 {
    font-size: 15px;
  }

  .results-toolbar p {
    font-size: 15px;
  }

  .result-card,
  .sponsored-card {
    padding: 17px 4px 19px;
    border-bottom: 4px solid var(--surface-soft);
    border-radius: 0;
  }

  .result-card:focus-within {
    border-color: transparent transparent var(--surface-soft);
  }

  .source-name,
  .source-path {
    max-width: min(68vw, 400px);
  }

  .result-title {
    font-size: 18px;
    line-height: 1.42;
  }

  .result-description {
    font-size: 15px;
    line-height: 1.6;
    -webkit-line-clamp: 4;
  }

  .pagination {
    gap: 10px;
  }

  .pagination button {
    min-width: 88px;
    padding: 0 14px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    padding-inline: 18px;
  }

  .footer nav {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .image-results-grid {
    grid-template-columns: 1fr;
  }

  .video-results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  body.results-mode .search-stage {
    padding-right: 58px;
    padding-left: 10px;
  }

  body.results-mode .search-row {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px;
  }

  .search-divider {
    display: none;
  }

  .type-tabs button {
    padding: 0 11px;
  }

  .search-main {
    width: calc(100% - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
