:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-2: #edf3ff;
  --panel: rgba(255, 255, 255, 0.48);
  --panel-strong: rgba(255, 255, 255, 0.74);
  --line: rgba(110, 128, 160, 0.2);
  --text: #152033;
  --muted: #6f7f98;
  --shadow: 0 24px 80px rgba(58, 83, 121, 0.16);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #081120;
  --bg-2: #111a2c;
  --panel: rgba(18, 28, 44, 0.5);
  --panel-strong: rgba(18, 28, 44, 0.74);
  --line: rgba(145, 170, 207, 0.15);
  --text: #eef4ff;
  --muted: #97a9c2;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: "Instrument Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(91, 140, 255, 0.18), transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(124, 92, 255, 0.15), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(78, 216, 255, 0.14), transparent 26%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.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;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
  opacity: 0.56;
}

.orb-a {
  top: 72px;
  left: -70px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.32), transparent 68%);
}

.orb-b {
  top: 120px;
  right: -84px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 68%);
}

.orb-c {
  bottom: 34px;
  left: 30%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.1), transparent 72%);
}

.page-shell {
  position: relative;
  width: min(980px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 54px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 8px;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.34);
  transform-origin: center;
}

.brand-copy strong {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.theme-toggle,
.search-panel,
.result-card,
.page-button,
.message-state {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.theme-toggle:hover {
  border-color: rgba(110, 128, 160, 0.3);
  box-shadow: 0 16px 36px rgba(58, 83, 121, 0.12), var(--glow);
}

.theme-toggle svg,
.search-icon svg,
.search-button svg,
.page-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-moon {
  display: none;
}

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

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

.layout {
  display: grid;
  gap: 18px;
}

.search-panel {
  position: sticky;
  top: 14px;
  z-index: 2;
  padding: 12px;
  border-radius: 30px;
}

.search-shell {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 0 8px 0 14px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.search-shell:focus-within {
  border-color: rgba(110, 128, 160, 0.3);
  box-shadow: 0 18px 42px rgba(67, 94, 133, 0.12);
}

.search-icon {
  color: var(--muted);
}

input[type="search"] {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: clamp(16px, 1.7vw, 18px);
  font-weight: 500;
  letter-spacing: -0.03em;
}

input[type="search"]::placeholder {
  color: var(--muted);
}

.search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(111, 132, 168, 0.34);
  padding: 0;
  border-radius: 18px;
  color: #16304d;
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.14)),
    linear-gradient(135deg, rgba(236, 245, 255, 0.62), rgba(220, 233, 251, 0.26));
  box-shadow:
    0 14px 30px rgba(83, 114, 161, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    inset 0 -1px 0 rgba(121, 145, 184, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  transition: background 160ms ease, box-shadow 160ms ease, border-color 160ms ease, filter 160ms ease;
}

.search-button:hover {
  border-color: rgba(111, 132, 168, 0.42);
  box-shadow:
    0 16px 34px rgba(83, 114, 161, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    inset 0 -1px 0 rgba(121, 145, 184, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.18)),
    linear-gradient(135deg, rgba(240, 247, 255, 0.68), rgba(224, 237, 255, 0.3));
  filter: saturate(1.04);
}

.search-button-glyph {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  opacity: 0.96;
}

:root[data-theme="dark"] .search-button {
  border-color: rgba(255, 255, 255, 0.12);
  color: #eef4ff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)),
    linear-gradient(135deg, rgba(84, 118, 176, 0.22), rgba(43, 60, 93, 0.16));
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(112, 144, 198, 0.08);
}

:root[data-theme="dark"] .search-button:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(112, 144, 198, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05)),
    linear-gradient(135deg, rgba(96, 132, 194, 0.26), rgba(52, 73, 109, 0.2));
}

.results {
  display: grid;
  gap: 12px;
}

.result-card {
  padding: 18px 18px 17px;
  border-radius: 26px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.result-card:hover {
  border-color: rgba(110, 128, 160, 0.26);
  box-shadow: 0 22px 58px rgba(67, 94, 133, 0.14), var(--glow);
}

.result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.result-favicon {
  width: 24px;
  height: 24px;
  border-radius: 9px;
  flex: 0 0 auto;
  box-shadow: 0 8px 18px rgba(67, 94, 133, 0.12);
}

.result-site {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.result-host {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.result-engine {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.1);
}

.result-title {
  display: inline-block;
  margin-bottom: 8px;
  text-decoration: none;
  font-size: clamp(18px, 1.65vw, 20px);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.035em;
  transition: color 160ms ease;
}

.result-title:hover,
.result-url:hover {
  color: var(--text);
}

.result-snippet {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.result-url {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  word-break: break-all;
}

.message-state {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: start;
  padding: 22px;
  border-radius: 26px;
  animation: surface-in 220ms ease both;
}

.message-mark {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.14)),
    linear-gradient(135deg, rgba(236, 245, 255, 0.56), rgba(220, 233, 251, 0.22));
  box-shadow:
    0 10px 24px rgba(83, 114, 161, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(121, 145, 184, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.message-mark::before,
.message-mark::after {
  content: "";
  position: absolute;
  left: 11px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

.message-mark::before {
  top: 15px;
  width: 18px;
}

.message-mark::after {
  top: 23px;
  width: 11px;
}

:root[data-theme="dark"] .message-mark {
  border-color: rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03)),
    linear-gradient(135deg, rgba(84, 118, 176, 0.18), rgba(43, 60, 93, 0.14));
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(112, 144, 198, 0.08);
}

.message-copy {
  display: grid;
  gap: 6px;
}

.message-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.message-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.loading-state {
  display: grid;
  gap: 16px;
  animation: surface-in 220ms ease both;
}

.loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow), var(--glow);
  color: var(--text);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  font-size: 13px;
  font-weight: 500;
}

.loading-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.9;
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.loading-grid {
  display: grid;
  gap: 12px;
}

.loading-card {
  padding: 18px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

.loading-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(110, 128, 160, 0.08) 0%,
    rgba(110, 128, 160, 0.16) 50%,
    rgba(110, 128, 160, 0.08) 100%
  );
  background-size: 200% 100%;
  animation: shimmer-line 1.4s linear infinite;
}

.loading-line + .loading-line {
  margin-top: 12px;
}

.loading-line-sm {
  width: 26%;
}

.loading-line-lg {
  width: 58%;
}

.loading-line-xs {
  width: 34%;
}

.pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.page-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.page-button.active {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-color: rgba(110, 128, 160, 0.2);
}

:root[data-theme="dark"] .page-button.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(145, 170, 207, 0.18);
}

.page-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.page-button:not(:disabled):hover {
  border-color: rgba(110, 128, 160, 0.28);
  box-shadow: 0 14px 28px rgba(58, 83, 121, 0.08), var(--glow);
}

.page-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@keyframes surface-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer-line {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

@keyframes pulse-dot {
  from {
    opacity: 0.35;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100%, calc(100% - 16px));
    padding-top: 12px;
  }

  .search-shell {
    grid-template-columns: 18px 1fr auto;
    min-height: 64px;
  }

  .search-button {
    min-width: 52px;
    height: 52px;
    padding: 0 12px;
    gap: 0;
  }

  .search-button-text {
    display: none;
  }

  .result-card {
    padding: 16px;
  }

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

  .message-state {
    grid-template-columns: 1fr;
  }

  .message-mark {
    width: 36px;
    height: 36px;
  }

  .page-button span:not(.page-button-icon) {
    display: none;
  }

  .page-button {
    padding: 0 12px;
  }
}
