:root {
  --brand-primary: #00c6f3;
  --brand-action: #00befa;
  --brand-hover: #00b4fa;
  --brand-blue: #1787f8;
  --text-primary: #333;
  --text-secondary: #666;
  --text-tertiary: #999;
  --text-disabled: #bfc4cc;
  --page-bg: #f6f8fc;
  --surface: #fff;
  --table-head: #f9fafc;
  --subtle-bg: #f3f5f8;
  --line: #edf0f5;
  --highlight: #fff0d8;
  --radius: 12px;
  --shadow: 0 4px 22px rgba(44, 76, 132, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 1240px;
  min-height: 100%;
  color: var(--text-primary);
  background: var(--page-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button {
  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;
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(225, 237, 255, 0.92) 0, rgba(247, 249, 253, 0.96) 220px),
    var(--page-bg);
}

.product-tabs {
  display: flex;
  height: 56px;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--subtle-bg);
  background: var(--surface);
}

.product-tab {
  height: 36px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #333;
  font-size: 14px;
  cursor: pointer;
}

.product-tab + .product-tab {
  margin-left: 8px;
}

.product-tab.is-active {
  border-color: rgba(0, 198, 243, 0.3);
  color: var(--brand-primary);
  background: rgba(0, 198, 243, 0.08);
  font-weight: 600;
  box-shadow: none;
}

.product-tab:hover:not(.is-active) {
  color: var(--brand-hover);
  background: var(--table-head);
}

.search-page {
  width: 100%;
  min-height: calc(100vh - 56px);
  padding: 20px;
}

.search-head {
  display: grid;
  grid-template-columns: 40px 120px minmax(980px, 1fr);
  align-items: start;
  gap: 12px;
}

.back-button {
  width: 36px;
  height: 36px;
  margin-top: 16px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 12px rgba(38, 54, 82, 0.1);
  font-size: 28px;
  line-height: 30px;
  cursor: pointer;
}

.back-button:hover {
  color: var(--brand-blue);
}

.brand-title {
  margin: 22px 0 0;
  font-size: 18px;
  line-height: 24px;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand-title span {
  color: #075beb;
}

.brand-title b {
  color: #df53ee;
}

.search-panel {
  position: relative;
  z-index: 20;
  min-height: 68px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-main {
  display: grid;
  grid-template-columns: 118px minmax(420px, 1fr) 112px 48px;
  align-items: center;
  height: 68px;
  padding: 0 10px 0 20px;
}

.search-input-wrap {
  display: flex;
  height: 40px;
  align-items: center;
}

.search-input-wrap input {
  width: 100%;
  height: 40px;
  border: 0;
  outline: 0;
  color: #292929;
  background: transparent;
  font-size: 14px;
}

.select-control {
  position: relative;
  min-width: 112px;
}

.select-trigger,
.advanced-toggle {
  display: flex;
  width: 100%;
  height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.search-type .select-trigger {
  padding-left: 0;
  font-size: 14px;
}

.advanced-toggle {
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
}

.chevron {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #c7cbd1;
  border-bottom: 1.5px solid #c7cbd1;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}

[aria-expanded="true"] .chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.search-button {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  justify-self: end;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--brand-blue);
  cursor: pointer;
  transition: background 0.18s ease;
}

.search-button:hover {
  background: #0878e8;
}

.search-icon {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
  transform: rotate(48deg);
}

.advanced-filters {
  display: none;
  min-height: 64px;
  align-items: center;
  gap: 20px;
  padding: 0 20px 12px 118px;
  border-top: 1px solid transparent;
}

.advanced-filters.is-open {
  display: flex;
}

.filter-control {
  display: flex;
  min-width: 176px;
  align-items: center;
  white-space: nowrap;
}

.filter-label {
  color: var(--text-tertiary);
}

.filter-control .select-control {
  min-width: 108px;
  border-bottom: 1px solid #e5e9f0;
}

.filter-control .select-trigger {
  height: 40px;
  padding: 0 8px;
  color: #444;
}

.semantic-only {
  display: none;
}

.search-panel.is-semantic .semantic-only {
  display: flex;
  min-width: 330px;
}

.search-panel.is-semantic .keyword-only {
  display: none;
}

.select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  display: none;
  width: 100%;
  min-width: 170px;
  padding: 6px 0;
  border: 1px solid #e5eaf1;
  background: #fff;
  box-shadow: 0 8px 20px rgba(32, 46, 72, 0.12);
}

.select-control.is-open .select-menu {
  display: block;
}

.select-menu button {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 14px;
  border: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.select-menu button:hover,
.select-menu button.is-selected {
  color: var(--brand-blue);
  background: #eaf4ff;
}

.similarity-control {
  display: flex;
  align-items: center;
  gap: 18px;
}

.similarity-control input[type="range"] {
  width: 140px;
  accent-color: var(--brand-blue);
}

.similarity-control input[type="number"] {
  width: 84px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #dfe4eb;
  border-radius: 7px;
  outline: 0;
}

.reset-button {
  margin-left: auto;
  align-self: center;
  border: 0;
  color: var(--brand-blue);
  background: transparent;
  cursor: pointer;
}

.results-section {
  margin-top: 20px;
}

.result-count {
  margin: 0 0 16px 0;
  color: #4b4b4b;
  font-size: 14px;
}

.result-list {
  display: grid;
  gap: 12px;
}

.result-card {
  min-height: 132px;
  padding: 18px 20px 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 16px rgba(47, 76, 124, 0.025);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.result-card:hover {
  transform: none;
  background: rgba(0, 198, 243, 0.04);
  box-shadow: 0 8px 24px rgba(47, 76, 124, 0.07);
}

.result-top {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 10px;
}

.word-icon {
  position: relative;
  display: grid;
  width: 24px;
  height: 28px;
  place-items: center;
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(180deg, #9bd1ff 0, #2e87e9 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  font-size: 12px;
  font-weight: 600;
}

.word-icon::after {
  position: absolute;
  top: 0;
  right: 0;
  border-top: 8px solid #e9f5ff;
  border-left: 8px solid transparent;
  content: "";
}

.result-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #373737;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-title-button {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.document-title-button:hover,
.document-title-button:focus-visible {
  color: var(--brand-primary);
}

.document-title-button:focus-visible {
  border-radius: 3px;
  outline: 2px solid rgba(0, 198, 243, 0.3);
  outline-offset: 2px;
}

mark {
  padding: 0 2px;
  color: inherit;
  background: var(--highlight);
}

.language-tags {
  display: inline-flex;
  gap: 8px;
  margin-left: 10px;
  vertical-align: 1px;
}

.document-tags {
  display: inline-flex;
  gap: 8px;
  margin-left: 8px;
  vertical-align: 1px;
}

.language-tag {
  display: inline-flex;
  width: 28px;
  min-width: 28px;
  height: 22px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 15px;
  color: #333;
  background: #8c8c8c;
  font-size: 12px;
  font-weight: 400;
}

.language-more {
  letter-spacing: 1px;
  cursor: help;
}

.security-tag,
.version-tag {
  display: inline-flex;
  height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 400;
  line-height: 22px;
  white-space: nowrap;
}

.security-tag {
  color: #8a6512;
  border: 1px solid #efd79a;
  background: #fffaf0;
}

.security-tag.is-secret {
  color: #c54a45;
  border-color: #f2b8b5;
  background: #fff7f6;
}

.security-tag.is-public {
  color: #3b8060;
  border-color: #b9dfca;
  background: #f5fbf7;
}

.version-tag {
  color: #177ddc;
  background: #eaf4ff;
}

.upload-time {
  color: #aeb4bd;
  font-size: 12px;
  white-space: nowrap;
}

.download-button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  color: #aeb4bd;
  background: transparent;
  cursor: pointer;
}

.download-button:hover {
  color: var(--brand-blue);
}

.download-icon {
  position: relative;
  display: block;
  width: 16px;
  height: 17px;
  border-bottom: 1.5px solid currentColor;
}

.download-icon::before {
  position: absolute;
  top: 1px;
  left: 7px;
  width: 1.5px;
  height: 10px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}

.download-icon::after {
  position: absolute;
  top: 6px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: rotate(45deg);
}

.result-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 0 40px;
}

.knowledge-points {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0 40px;
}

.knowledge-tag {
  display: inline-flex;
  height: 22px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(0, 198, 243, 0.3);
  border-radius: 6px;
  color: #158ca9;
  background: rgba(0, 198, 243, 0.06);
  font-size: 12px;
  line-height: 20px;
}

.library-name,
.creator-name {
  margin-left: 2px;
  color: #666;
  font-size: 12px;
  line-height: 20px;
}

.library-name span,
.creator-name span {
  color: #999;
}

.creator-name {
  padding-left: 12px;
  border-left: 1px solid #e5e8ed;
}

.meta-tag {
  height: 24px;
  padding: 3px 9px;
  border-radius: 6px;
  color: #adb2ba;
  background: #f5f7fa;
  font-size: 12px;
}

.score strong {
  color: var(--brand-blue);
  font-size: 13px;
}

.result-content {
  margin: 12px 0 0 40px;
  color: #60646b;
  font-size: 14px;
  line-height: 20px;
}

.result-content.is-clamped {
  display: -webkit-box;
  max-height: 60px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  cursor: default;
}

.poster-block {
  margin: 12px 0 0 40px;
}

.summary-section {
  position: relative;
}

.summary-preview {
  position: relative;
  outline: 0;
}

.summary-preview:focus-visible .result-content {
  border-radius: 4px;
  outline: 2px solid rgba(0, 198, 243, 0.3);
  outline-offset: 3px;
}

.summary-popover {
  position: absolute;
  right: 20px;
  bottom: calc(100% + 10px);
  left: 40px;
  z-index: 80;
  visibility: hidden;
  max-height: 360px;
  overflow: auto;
  padding: 16px 18px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(32, 46, 72, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}

.summary-popover::after {
  position: absolute;
  bottom: -6px;
  left: 36px;
  width: 10px;
  height: 10px;
  border-right: 1px solid #e7ebf0;
  border-bottom: 1px solid #e7ebf0;
  background: #fff;
  content: "";
  transform: rotate(45deg);
}

.summary-preview:hover .summary-popover,
.summary-preview:focus-within .summary-popover {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.summary-full {
  margin: 0;
  color: #4f545b;
  font-size: 14px;
  line-height: 24px;
}

.popover-knowledge-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #edf0f4;
}

.poster {
  position: relative;
  width: 136px;
  height: 200px;
  overflow: hidden;
  border: 8px solid #fbfbfb;
  border-radius: 8px;
  box-shadow: 0 3px 14px rgba(36, 48, 70, 0.08);
}

.poster-rings {
  background:
    radial-gradient(ellipse at 50% 80%, transparent 0 14%, #fafafa 15% 20%, transparent 21%),
    radial-gradient(ellipse at 50% 70%, transparent 0 13%, #7fd063 14% 18%, transparent 19%),
    radial-gradient(ellipse at 50% 59%, transparent 0 15%, #f0d753 16% 21%, transparent 22%),
    radial-gradient(ellipse at 50% 48%, transparent 0 15%, #e67273 16% 21%, transparent 22%),
    radial-gradient(ellipse at 50% 37%, transparent 0 12%, #6ccce1 13% 18%, transparent 19%),
    linear-gradient(100deg, #bfc3bf, #eceeea 45%, #abb2ae);
}

.poster-rings::before {
  position: absolute;
  inset: 10px;
  color: #3f4545;
  content: "The 10th Beijing International Film Festival";
  font-size: 11px;
  line-height: 1.1;
}

.poster-red {
  background:
    linear-gradient(145deg, transparent 32%, rgba(255, 195, 90, 0.92) 33% 37%, transparent 38%),
    linear-gradient(28deg, transparent 43%, rgba(22, 85, 92, 0.78) 44% 51%, transparent 52%),
    linear-gradient(155deg, #8f0009, #de1c14 55%, #7b0005);
}

.poster-red::before {
  position: absolute;
  inset: 16px;
  border-top: 7px solid rgba(255, 214, 103, 0.75);
  border-radius: 50%;
  color: #ffd576;
  content: "北京国际电影节";
  font-size: 12px;
  writing-mode: vertical-rl;
}

.poster-caption {
  margin-top: 8px;
  color: #4f5359;
  font-size: 14px;
}

.pagination {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
  color: #666;
}

.pagination button {
  min-width: 32px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.pagination button:disabled {
  color: #c8cdd4;
  cursor: not-allowed;
}

.page-buttons {
  display: flex;
  gap: 4px;
}

.page-buttons button.is-active {
  color: var(--brand-blue);
  font-weight: 600;
}

.page-size select,
#jumpPage {
  height: 32px;
  border: 1px solid #dfe4ec;
  border-radius: 7px;
  color: #666;
  background: #fff;
  outline: 0;
}

.page-size select {
  min-width: 112px;
  padding: 0 12px;
}

#jumpPage {
  width: 56px;
  padding: 0 8px;
  text-align: center;
}

.empty-state {
  padding: 90px 20px;
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}

.empty-search-icon {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--brand-primary);
  background: rgba(0, 198, 243, 0.08);
}

.empty-state h2 {
  margin: 18px 0 8px;
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  color: var(--text-tertiary);
}

.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  z-index: 100;
  visibility: hidden;
  padding: 10px 18px;
  border-radius: 7px;
  color: #fff;
  background: rgba(40, 48, 60, 0.88);
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1500px) {
  .search-page {
    padding-right: 20px;
    padding-left: 20px;
  }

  .search-head {
    grid-template-columns: 40px 120px minmax(980px, 1fr);
    gap: 12px;
  }

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

  .advanced-filters {
    gap: 16px;
    padding-left: 80px;
  }

  .filter-control {
    min-width: 166px;
  }
}
