* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #333;
  --muted: #666;
  --line: #e9e9e9;
  --soft: #f7f7f7;
  --accent: #469b91;
  --accent-dark: #2f756e;
  --link: #2f756e;
  --link-soft: #eaf5f3;
  --link-border: #b8d8d3;
  --ink-accent: #235f78;
}

body {
  min-width: 320px;
  background: #fff;
  color: var(--text);
  font-family: "Microsoft Yahei", "PingFang SC", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

a {
  color: inherit;
}

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

.top-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  background: #444;
  padding: 8px 15px;
  font-size: 13px;
}

.top-nav a,
.top-link {
  color: #ccc;
  text-decoration: none;
  margin-right: 18px;
  font-size: 13px;
}

.top-nav a:hover,
.top-nav a:focus-visible,
.top-link:hover,
.top-link:focus-visible {
  color: #fff;
}

.top-nav-right {
  display: flex;
  gap: 18px;
}

.top-nav-right a {
  margin-right: 0;
}

.open-link {
  cursor: pointer;
  transition: color 0.2s ease;
}

.header {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 20px 40px;
  border-bottom: 1px solid #eee;
}

.logo {
  flex: 0 0 auto;
  font-size: 28px;
  font-weight: 700;
  color: #444;
}

.search-box {
  display: flex;
  flex: 1 1 500px;
  max-width: 560px;
  border-radius: 3px;
  transition: border-color 0.18s ease;
}

.search-box input {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-right: 0;
  border-radius: 3px 0 0 3px;
  font-size: 14px;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.search-box button {
  width: 45px;
  border: 1px solid #ddd;
  border-radius: 0 3px 3px 0;
  background: #ddd;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.search-box:focus-within {
  outline: 2px solid rgb(70 155 145 / 0.18);
  outline-offset: 1px;
}

.search-box input:hover,
.search-box input:focus {
  border-color: var(--link-border);
  background: #fcfefe;
}

.search-box button:hover {
  border-color: var(--link-border);
  background: var(--link-soft);
  color: var(--accent-dark);
}

.search-box button:active {
  transform: scale(0.96);
}

.search-box input:focus-visible,
.search-box button:focus-visible,
.category-tab:focus-visible,
.pager-btn:focus-visible,
.resource-action:focus-visible,
.expand-btn:focus-visible,
.inline-doc-link:focus-visible,
.favorite-site-btn:focus-visible,
.modal_wraper button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-right {
  flex: 0 0 auto;
}

.year-badge {
  border: 2px solid var(--accent);
  padding: 5px 10px;
  color: var(--accent);
  font-weight: 700;
  line-height: 1.25;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 4fr) 280px;
  gap: 20px;
  height: calc(100vh - 128px);
  min-height: 420px;
  padding: 0 40px 20px;
  align-items: stretch;
  overflow: hidden;
}

.left-panel,
.kong {
  min-width: 0;
  height: 100%;
  max-height: 100%;
  margin-top: 10px;
  overflow: auto;
  overscroll-behavior: contain;
}

.category-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.category-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.detail-nav-bar {
  position: sticky;
  top: 0;
  z-index: 12;
  background: #fff;
}

.category-tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 18px;
  align-items: center;
}

.category-tab {
  flex: 0 1 auto;
  max-width: 150px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #333;
  padding: 5px 8px;
  font-size: 15px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.category-tab:hover {
  background: #f5f5f5;
  color: var(--accent-dark);
}

.category-tab.active {
  color: var(--accent-dark);
  font-weight: 700;
  background: #edf7f5;
}

.mini-pager,
.resource-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.mini-pager {
  position: relative;
}

.pager-btn {
  min-width: 28px;
  height: 24px;
  border: 1px solid var(--link-border);
  border-radius: 3px;
  background: #fff;
  color: var(--link);
  padding: 0 7px;
  line-height: 22px;
  transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.mini-page-btn {
  min-width: 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 12px;
  line-height: 20px;
}

.pager-btn:hover:not(:disabled) {
  background: var(--link-soft);
  border-color: #7fbab1;
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.pager-btn:active:not(:disabled) {
  transform: translateY(0);
}

.pager-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.pager-label {
  color: var(--link);
  font-weight: 600;
}

.more-category-btn {
  display: inline-flex;
  align-items: center;
  height: 22px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: var(--link-soft);
  color: var(--link);
  padding: 0 6px;
  font-size: 12px;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

.more-category-btn:hover,
.more-category-btn.active {
  border-color: var(--link-border);
  background: #dff0ed;
  box-shadow: 0 0 0 3px rgb(70 155 145 / 0.1);
}

.more-category-btn:active {
  transform: translateY(1px) scale(0.98);
}

.category-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 6px;
  width: min(320px, calc(100vw - 80px));
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
}

.category-menu-item {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #fff;
  color: #333;
  padding: 6px 8px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-menu-item:hover {
  background: #f5f5f5;
  color: var(--accent-dark);
}

.category-menu-item.active {
  border-color: var(--link-border);
  background: var(--link-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.mini-pager.has-more .page-next:not(:disabled) {
  animation: next_hint 1.8s ease-in-out infinite;
}

.mini-pager.pager-clicked {
  animation: pager_click 0.22s ease-out;
}

.resource-list {
  flex: 1;
  min-height: 0;
  padding: 16px 10px;
}

.resource-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 6px 16px;
  border-bottom: 1px solid #f1f1f1;
}

.resource-item:last-child {
  border-bottom: 0;
}

.resource-thumb {
  width: 76px;
  height: 58px;
  border: 1px solid #eee;
  border-radius: 3px;
  background: var(--soft);
  object-fit: cover;
}

.resource-thumb.placeholder {
  display: grid;
  place-items: center;
  color: #999;
  font-size: 12px;
  text-align: center;
}

.resource-main {
  min-width: 0;
}

.resource-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.resource-title {
  min-width: 0;
  max-width: 100%;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.resource-title-button {
  text-align: left;
}

.resource-title-button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.resource-link-target {
  cursor: pointer;
}

.resource-actions {
  display: inline-flex;
  gap: 5px;
}

.resource-action {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border: 1px solid var(--link-border);
  border-radius: 3px;
  background: #fff;
  color: var(--link);
  padding: 0 7px;
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
}

.resource-action:hover:not(:disabled) {
  background: var(--link-soft);
  border-color: #7fbab1;
}

.resource-action:disabled {
  color: #aaa;
  border-color: #e6e6e6;
  cursor: not-allowed;
}

.resource-description-box {
  position: relative;
  color: #111;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.resource-description-box.collapsed {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 43.4px;
  padding-right: 58px;
}

.resource-description {
  color: inherit;
}

.keyword-hit {
  background: transparent;
  color: #d22f27;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.expand-btn {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--link);
  padding: 2px 4px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
}

.resource-description-box.collapsed .expand-btn {
  position: absolute;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgb(255 255 255 / 0.7), #fff 26%);
  padding-left: 18px;
}

.resource-description-box.expanded .expand-btn {
  display: flex;
  width: max-content;
  margin: 4px 0 0 auto;
}

.resource-pager {
  min-height: 42px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-jump-input {
  width: 48px;
  height: 24px;
  border: 1px solid var(--link-border);
  border-radius: 3px;
  color: var(--link);
  padding: 0 4px;
  text-align: center;
}

.page-jump-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.page-jump-btn,
.back-btn {
  height: 24px;
  border: 1px solid var(--link-border);
  border-radius: 3px;
  background: #fff;
  color: var(--link);
  padding: 0 7px;
  font-size: 12px;
}

.page-jump-btn:hover,
.back-btn:hover {
  background: var(--link-soft);
  border-color: #7fbab1;
}

.search-result-label {
  border-radius: 4px;
  background: #edf7f5;
  color: var(--accent-dark);
  padding: 5px 8px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.search-result-meta {
  color: var(--muted);
  font-size: 12px;
}

.state-box {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}

.kong {
  background: #fafafa;
  padding: 16px;
  border: 1px solid #eee;
  border-radius: 6px;
}

.notice-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: nowrap;
}

.notice-head h2 {
  flex: 0 0 auto;
  font-size: 22px;
  color: #444;
  white-space: nowrap;
}

.inline-doc-link:hover {
  color: var(--accent-dark);
}

.inline-doc-link:active {
  transform: translateY(1px);
}

.favorite-site-btn {
  margin-left: auto;
  border: 1px solid var(--link-border);
  border-radius: 3px;
  color: var(--link);
  padding: 3px 7px;
  font-size: 12px;
}

.favorite-site-btn:hover {
  background: var(--link-soft);
}

.notice-alert {
  border-left: 3px solid var(--accent);
  background: #edf7f5;
  color: #244b47;
  padding: 8px 10px;
  margin-bottom: 12px;
  font-weight: 700;
}

.inline-doc-link {
  color: var(--link);
  text-decoration: underline;
}

.kong p {
  color: #555;
  line-height: 1.45;
}

.modal_wraper {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #0005;
  visibility: hidden;
  opacity: 0;
  transition: 0.2s ease-in-out;
}

.modal_wraper.active {
  visibility: visible;
  opacity: 1;
}

.modal_container {
  display: none;
  width: 100%;
  max-width: 450px;
  overflow: hidden;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 1px 6px #0001, 0 2px 10px #0002;
}

.doc-modal {
  max-width: min(920px, calc(100vw - 36px));
}

.modal_wraper.active .modal_container {
  display: block;
  animation: modal_open_animation 0.2s ease-in-out 0.05s both;
}

.modal_wraper.modal_close_animation .modal_container {
  animation: modal_close_animation 0.16s ease-in-out both;
}

.modal_header,
.modal_footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  color: #000;
  font-weight: 700;
}

.modal_body {
  max-height: 80vh;
  overflow: auto;
  border-top: 1px solid #0002;
  border-bottom: 1px solid #0002;
  padding: 20px;
  line-height: 1.8;
}

.doc-modal-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  max-height: min(78vh, 760px);
  overflow: hidden;
}

.doc-content {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 20px 24px;
  color: #111;
  font-family: "Microsoft Yahei", "PingFang SC", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-y: auto;
}

.modal_wraper.has-consent .doc-content {
  padding-bottom: 24px;
}

.doc-consent {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-top: 1px solid var(--line);
  background: #fafafa;
  padding: 10px 18px 12px;
  box-shadow: 0 -8px 18px rgb(0 0 0 / 0.04);
}

.doc-consent[hidden] {
  display: none !important;
}

.consent-hint {
  display: none;
}

.consent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 100%);
  margin-bottom: 7px;
  color: #333;
  font-size: 13px;
  justify-content: flex-start;
}

.consent-continue {
  width: min(190px, 100%);
  border: 1px solid var(--link-border);
  border-radius: 4px;
  background: var(--link);
  color: #fff;
  padding: 6px 10px;
  font-size: 13px;
}

.consent-continue:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.detail-header {
  align-items: flex-start;
}

.detail-header-thumb {
  flex: 0 0 92px;
  width: 92px;
  height: 72px;
  border: 1px solid #eee;
  border-radius: 4px;
  background: var(--soft);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #999;
  font-size: 12px;
}

.detail-header-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-header-copy h1 {
  margin-bottom: 4px;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.detail-header-copy p {
  margin-bottom: 8px;
  color: #444;
  font-size: 12px;
  line-height: 1.4;
}

.detail-download {
  width: max-content;
}

.detail-mode .two-column {
  grid-template-columns: minmax(0, 1fr) 280px;
}

.detail-content {
  padding: 0;
}

.detail-section {
  padding: 20px 18px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 12px;
}

.detail-section h2 {
  margin-bottom: 12px;
  color: #222;
  font-size: 18px;
}

.detail-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #111;
  font-family: "Microsoft Yahei", "PingFang SC", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.8;
}

.detail-page-frame {
  display: block;
  width: 100%;
  height: 1180px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.detail-favorite-section {
  display: flex;
  justify-content: center;
  padding: 24px 18px 32px;
}

.favorite-page-btn {
  border: 1px solid var(--link-border);
  border-radius: 4px;
  background: var(--link);
  color: #fff;
  padding: 8px 16px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  display: flex;
}
.toast[hidden] {
  display: none;
}
.toast {
  align-items: center;
  gap: 10px;
  border: 1px solid var(--link-border);
  border-radius: 6px;
  background: #fff;
  color: #222;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14);
  font-size: 13px;
}

.modal_container .close {
  border: 1px solid #c62828;
  border-radius: 4px;
  background: #c62828;
  color: #fff5f5;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
}

.modal_container .close:hover {
  background: #a91f1f;
  border-color: #a91f1f;
}

.modal_footer .close.btn {
  border-radius: 4px;
  background: orangered;
  color: #fff;
  padding: 8px 15px;
}

.detail-modal {
  max-width: min(1000px, calc(100vw - 36px));
}

.detail-body {
  height: min(78vh, 820px);
  padding: 0;
  background: #f6f6f6;
}

.detail-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.detail-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

@keyframes modal_open_animation {
  from {
    transform: scale(0.96);
  }
  to {
    transform: scale(1);
  }
}

@keyframes modal_close_animation {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(0.96);
  }
}

@keyframes next_hint {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 0 3px rgb(70 155 145 / 0.14);
  }
}

@keyframes pager_click {
  from {
    transform: translateX(0);
  }
  45% {
    transform: translateX(3px);
  }
  to {
    transform: translateX(0);
  }
}

@media (max-width: 900px) {
  .header {
    flex-wrap: wrap;
    gap: 14px;
    padding: 16px 20px;
  }

  .search-box {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }

  .two-column {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 0 20px 20px;
  }

  .left-panel,
  .kong {
    height: auto;
    max-height: none;
  }

  .detail-mode .two-column {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .top-nav,
  .top-nav-right {
    gap: 10px;
  }

  .top-nav a {
    margin-right: 0;
  }

  .logo {
    font-size: 22px;
  }

  .year-badge {
    font-size: 13px;
  }

  .category-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .category-tabs {
    flex-wrap: wrap;
    gap: 8px;
  }

  .category-tab {
    max-width: calc(50vw - 42px);
  }

  .mini-pager {
    justify-content: flex-end;
  }

  .resource-item {
    grid-template-columns: 62px minmax(0, 1fr);
    padding-inline: 0;
  }

  .resource-thumb {
    width: 62px;
    height: 52px;
  }

  .detail-page-frame {
    height: 900px;
  }

  .doc-content {
    padding: 16px;
    font-size: 14px;
  }
}
