/* Mirrors the current /zh-hans/ directory homepage styling. Kept English-only to avoid changing other locales. */
:root {
      --page: #f7f8fb;
      --surface: #ffffff;
      --surface-muted: #f0f7f6;
      --ink: #17212b;
      --muted: #5b6876;
      --line: #dfe5ec;
      --accent: #0f766e;
      --accent-dark: #0f4f4a;
      --hot: #b8325f;
      --soft-hot: #fff1f5;
      --shadow: 0 10px 24px rgba(23, 33, 43, 0.08);
      --max: 1160px;
    }

    * {
      box-sizing: border-box;
    }

    html {
      scroll-behavior: smooth;
    }

    body {
      min-width: 320px;
      margin: 0;
      color: var(--ink);
      background: var(--page);
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Microsoft YaHei", sans-serif;
      line-height: 1.55;
      padding-bottom: 20px;
    }

    a {
      color: inherit;
      text-decoration: none;
    }

    button,
    input {
      font: inherit;
    }

    button {
      cursor: pointer;
    }

    button:focus-visible,
    a:focus-visible,
    input:focus-visible {
      outline: 3px solid rgba(15, 118, 110, .32);
      outline-offset: 3px;
    }

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

    .topbar {
      background: var(--page);
    }

    .topbar-inner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      width: min(var(--max), calc(100% - 40px));
      min-height: 64px;
      margin: 0 auto;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: max-content;
      color: #3a2f2a;
    }

    .brand-mark {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      color: #fff;
      font-size: 22px;
      font-weight: 800;
      border: 1px solid rgba(255, 255, 255, 0.45);
      border-radius: 10px;
      background: linear-gradient(135deg, #c8955f, #f06292);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    }

    .brand-text {
      display: flex;
      flex-direction: column;
      line-height: 1.1;
    }

    .brand-name {
      font-size: 18px;
      font-weight: 545;
    }

    .brand-tagline {
      font-size: 12px;
      font-weight: 545;
    }

    .top-links {
      position: relative;
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--muted);
      font-size: 14px;
    }

    .bookmark-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      min-height: 34px;
      padding: 5px 9px;
      color: var(--accent-dark);
      font-size: 13px;
      line-height: 1.2;
      border: 1px solid #bed9d5;
      border-radius: 7px;
      background: #f4faf8;
    }

    .bookmark-button:hover {
      color: var(--hot);
      border-color: #e7a8bd;
      background: var(--soft-hot);
    }

    .bookmark-icon {
      font-size: 17px;
      line-height: 1;
    }

    .bookmark-toast {
      position: absolute;
      z-index: 35;
      top: calc(100% + 8px);
      right: 0;
      width: max-content;
      max-width: min(290px, calc(100vw - 28px));
      margin: 0;
      padding: 8px 10px;
      color: #34414d;
      font-size: 12px;
      line-height: 1.45;
      pointer-events: none;
      visibility: hidden;
      opacity: 0;
      border: 1px solid #bed9d5;
      border-radius: 6px;
      background: #fff;
      box-shadow: 0 6px 16px rgba(23, 33, 43, .14);
      transform: translateY(-4px);
      transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
    }

    .bookmark-toast.is-visible {
      visibility: visible;
      opacity: 1;
      transform: translateY(0);
    }

    .site-tooltip {
      position: fixed;
      z-index: 60;
      width: min(270px, calc(100vw - 24px));
      padding: 9px 10px;
      color: #34414d;
      font-size: 12px;
      line-height: 1.55;
      pointer-events: none;
      visibility: hidden;
      opacity: 0;
      border: 1px solid #bed9d5;
      border-radius: 7px;
      background: #fff;
      box-shadow: 0 8px 20px rgba(23, 33, 43, .16);
      transition: opacity .14s ease, visibility .14s ease;
    }

    .site-tooltip.is-visible {
      visibility: visible;
      opacity: 1;
    }

    .page {
      width: min(var(--max), calc(100% - 40px));
      margin: 0 auto;
    }

    .search-area {
      padding: 0px 0 0px;
    }

    .search-form {
      --search-button-width: 86px;
      position: relative;
      display: flex;
      align-items: center;
      max-width: 760px;
      margin: 0 auto;
      overflow: hidden;
      border: 1px solid #b7ceca;
      border-radius: 7px;
      background: #fff;
      box-shadow: 0 3px 10px rgba(23, 33, 43, .05);
    }

    .search-input {
      flex: 1 1 auto;
      width: auto;
      min-width: 0;
      height: 48px;
      padding: 0 46px 0 14px;
      color: var(--ink);
      font-size: 16px;
      border: 0;
      outline: 0;
      -webkit-appearance: none;
      appearance: none;
      background: transparent;
    }

    .search-input::placeholder {
      color: #89949f;
    }

    .search-clear {
      display: none;
      position: absolute;
      z-index: 1;
      top: 50%;
      right: calc(var(--search-button-width) + 5px);
      width: 36px;
      height: 36px;
      margin: 0;
      color: #788490;
      font-size: 26px;
      font-weight: 300;
      line-height: .9;
      border: 0;
      border-radius: 50%;
      background: transparent;
      transform: translateY(-50%);
    }

    .search-clear:hover {
      color: var(--ink);
      background: #eef2f4;
    }

    .search-clear.is-visible {
      display: block;
    }

    .search-button {
      flex: 0 0 auto;
      align-self: stretch;
      min-width: var(--search-button-width);
      color: #fff;
      font-weight: 700;
      border: 0;
      background: var(--accent);
      font-size: 16px;
    }

    .search-button:hover {
      background: var(--accent-dark);
    }

    .search-feedback {
      display: none;
      max-width: 760px;
      min-height: 20px;
      margin: 9px auto 0;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.45;
      text-align: center;
    }

    .search-feedback.is-visible {
      display: block;
    }

    .search-feedback.is-empty {
      color: var(--hot);
    }

    .search-feedback.is-hint {
      color: var(--accent-dark);
    }

    .quick-nav {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 4px 14px;
      max-width: 920px;
      margin: 13px auto 0;
      color: var(--muted);
      font-size: 13px;
    }

    .quick-nav button {
      padding: 0;
      color: inherit;
      font-size: inherit;
      border: 0;
      background: transparent;
    }

    .quick-nav button:hover,
    .quick-nav button.is-active {
      color: var(--hot);
    }

    .quick-nav button+button::before {
      margin-right: 14px;
      color: #c4cbd1;
      content: "/";
    }

    .direct-grid {
      display: grid;
      /* 桌面端 14 个常用入口刚好排成两行，每行 7 个，减少横向留白。 */
      grid-template-columns: repeat(7, minmax(0, 1fr));
      margin: 0 auto;
      padding: 14px 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      box-shadow: 0 3px 12px rgba(23, 33, 43, .035);
    }

    .direct-site {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 7px;
      min-width: 0;
      min-height: 86px;
      padding: 8px 5px;
      color: #26333d;
      text-align: center;
      font-size: 13px;
      border-radius: 6px;
    }

    .direct-site:hover {
      color: var(--hot);
      background: var(--soft-hot);
    }

    /* 搜索筛选依赖 hidden 属性；显式提高优先级，防止下面的 display:flex 覆盖浏览器默认隐藏规则。 */
    .direct-grid[hidden],
    .direct-site[hidden],
    .site-link[hidden],
    .category-row[hidden] {
      display: none !important;
    }

    .direct-favicon {
      display: block;
      width: 40px;
      height: 40px;
      box-sizing: border-box;
      padding: 3px;
      object-fit: contain;
      border-radius: 9px;
      background: #fff;
      border: 1px solid #edf0f3;
      box-shadow: 0 3px 7px rgba(23, 33, 43, .12);
    }

    .direct-site span:last-child {
      overflow: hidden;
      max-width: 100%;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .directory {
      padding: 0px 0 0px;
    }

    .directory-panel {
      overflow: visible;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      box-shadow: 0 3px 12px rgba(23, 33, 43, .035);
    }

    .category-row {
      display: block;
      border-bottom: 1px solid var(--line);
    }

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

    .category-heading {
      margin: 0;
    }

    .category-row--enhanced .category-heading {
      display: flex;
      align-items: stretch;
      border-bottom: 1px solid #e8eff0;
      background: #fff;
    }

    .category-row--enhanced .category-name {
      flex: 1 1 auto;
      width: auto;
      border-bottom: 0;
    }

    .category-row--enhanced .category-caret {
      width: 25px;
      height: 25px;
      /* margin-right: 8px; */
      margin-left: 0;
      /* font-size: 30px; */
      /* border-radius: 5px; */
      transform: translateY(-2px);
    }

    .category-row--enhanced .category-caret-icon {
      display: inline-block;
      transition: transform 0.5s ease;
    }

    .category-row--enhanced.is-collapsed .category-caret-icon {
      transform: rotate(-90deg);
    }

    .category-row--enhanced .category-caret::after {
      top: auto;
      right: auto;
      bottom: calc(100% + 8px);
      left: 50%;
      transform: translate(-50%, 3px);
    }

    .category-row--enhanced .category-caret.is-tooltip-visible::after {
      transform: translate(-50%, 0);
    }

    .category-more-link {
      display: inline-flex;
      flex: 0 0 auto;
      align-items: center;
      padding: 10px 16px 10px 10px;
      color: var(--accent-dark);
      font-size: 13px;
      font-weight: 540;
      white-space: nowrap;
    }

    .category-more-link:hover {
      color: var(--hot);
      font-weight: 600;
    }

    .category-name {
      display: flex;
      align-items: center;
      width: 100%;
      margin: 0;
      min-height: 43px;
      padding: 10px 16px;
      color: var(--accent-dark);
      font-size: 14px;
      font-weight: 750;
      text-align: left;
      border: 0;
      border-bottom: 1px solid #e8eff0;
      -webkit-appearance: none;
      appearance: none;
      background: #fff;
    }

    /* .category-name::before {
      width: 4px;
      height: 18px;
      margin-right: 9px;
      content: "";
      border-radius: 4px;
      background: var(--accent);
    } */

    .category-caret {
      position: relative;
      display: inline-grid;
      flex: 0 0 auto;
      width: 32px;
      height: 32px;
      margin-left: auto;
      place-items: center;
      color: var(--accent-dark);
      line-height: 0.9;
      /* border: 1px solid #bed9d5;
      border-radius: 7px; */
      font-size: 32px;
    }

    .category-caret::after {
      position: absolute;
      z-index: 20;
      top: 50%;
      right: calc(100% + 8px);
      padding: 6px 8px;
      color: #34414d;
      font-size: 12px;
      font-weight: 500;
      line-height: 1.2;
      white-space: nowrap;
      content: attr(data-tooltip);
      visibility: hidden;
      opacity: 0;
      border: 1px solid #bed9d5;
      border-radius: 5px;
      background: #fff;
      box-shadow: 0 4px 12px rgba(23, 33, 43, .2);
      transform: translate(3px, -50%);
      transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
    }

    .category-caret.is-tooltip-visible::after {
      visibility: visible;
      opacity: 1;
      transform: translate(0, -50%);
    }

    .category-row.is-collapsed .category-links {
      opacity: 0;
      pointer-events: none;
    }

    .category-name:hover {
      color: var(--hot);
      background: #fbfcfd;
    }

    .category-name:hover .category-caret {
      color: var(--hot);
    }

    .category-links {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      min-width: 0;
      overflow: hidden;
      opacity: 1;
      transition: height .5s ease, opacity .5s ease;
      will-change: height, opacity;
      padding-left: 12px;
    }

    .category-links .site-link:nth-child(n + 7) {
      border-top: 1px solid #edf1f3;
    }

    .site-link {
      position: relative;
      display: flex;
      align-items: center;
      min-width: 0;
      padding: 14px 12px;
      color: #34414d;
      font-size: 14px;
      white-space: nowrap;
    }

    .site-link::before {
      flex: 0 0 auto;
      width: 5px;
      height: 5px;
      margin-right: 8px;
      content: "";
      border-radius: 50%;
      background: #bdc8cf;
    }

    .site-link:hover {
      color: var(--hot);
      background: var(--soft-hot);
    }

    .site-link:hover::before {
      background: var(--hot);
    }

    .site-link span {
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .site-link[data-featured] {
      color: var(--hot);
      font-weight: 700;
    }

    .site-link[data-featured]::before {
      background: var(--hot);
    }

    @media (prefers-reduced-motion: reduce) {
      .category-links {
        transition: none;
      }
    }

    .site-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      border-top: 0;
      background: #fff;
    }

    .site-item {
      display: flex;
      align-items: center;
      min-width: 0;
      min-height: 48px;
      padding: 9px 13px;
      border-right: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
    }

    .site-item:nth-child(4n) {
      border-right: 0;
    }

    .site-item:hover {
      background: #f8fbfb;
    }

    .site-dot {
      flex: 0 0 auto;
      display: grid;
      width: 25px;
      height: 25px;
      margin-right: 9px;
      place-items: center;
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      border-radius: 6px;
      background: var(--dot, #0f766e);
    }

    .site-item strong {
      display: block;
      overflow: hidden;
      color: #28333d;
      font-size: 14px;
      font-weight: 650;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .site-item small {
      display: block;
      overflow: hidden;
      margin-top: 1px;
      color: #89949f;
      font-size: 11px;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .site-item:hover strong {
      color: var(--hot);
    }

    .site-grid.is-empty::after {
      grid-column: 1 / -1;
      padding: 22px;
      color: var(--muted);
      text-align: center;
      content: "未找到匹配站点";
    }

    .guides-line {
      display: flex;
      flex-wrap: wrap;
      gap: 6px 14px;
      margin: 25px 0 0;
      padding: 13px 15px;
      color: var(--muted);
      font-size: 13px;
      border: 1px solid #d7e5e2;
      border-radius: 7px;
      background: #f4faf8;
    }

    .guides-line b {
      color: var(--accent-dark);
    }

    .guides-line a:hover {
      color: var(--hot);
    }

    .guides-line a::before {
      margin-right: 14px;
      color: #c2ccca;
      content: "·";
    }

    .footer {
      margin-top: 0px;
      /* border-top: 1px solid var(--line); */
      background: #f4f6f9;
    }

    .footer-inner {
      width: min(var(--max), calc(100% - 40px));
      margin: 0 auto;
      padding: 0px 0 0px;
      text-align: center;
    }

    .footer-nav,
    .footer-links {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px 16px;
    }

    .footer-nav a,
    .footer-links a {
      min-height: 36px;
      padding: 7px 13px;
      color: var(--hot);
      font-size: 13px;
      border: 1px solid #f2d3df;
      border-radius: 7px;
      background: rgba(255, 255, 255, .76);
    }

    .footer-nav a:hover,
    .footer-links a:hover {
      border-color: var(--hot);
      background: var(--soft-hot);
    }

    .footer-links {
      margin: 0px auto 0;
      padding: 0px;
      /* border-top: 1px solid #e7ebf0;
      border-bottom: 1px solid #e7ebf0; */
      /* background: rgba(255, 255, 255, .52); */
    }

    .footer-note,
    .footer-disclosure,
    .footer-copy {
      max-width: 680px;
      margin-right: auto;
      margin-left: auto;
      color: #34465b;
      font-size: 14px;
      line-height: 1.75;
    }

    .footer-note {
      margin-top: 0px;
      margin-bottom: 0;
    }

    .footer-disclosure {
      margin-top: 12px;
      margin-bottom: 0;
    }

    .footer-copy {
      margin-top: 17px;
      margin-bottom: 0;
      color: #536273;
      font-size: 13px;
    }

    @media (max-width: 900px) {
      .direct-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }

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

      .category-links .site-link:nth-child(n + 4) {
        border-top: 1px solid #edf1f3;
      }

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

      .site-item:nth-child(4n) {
        border-right: 1px solid var(--line);
      }

      .site-item:nth-child(3n) {
        border-right: 0;
      }
    }

    @media (max-width: 640px) {

      .topbar-inner,
      .page {
        width: min(100% - 28px, var(--max));
      }

      .topbar-inner {
        min-height: 58px;
      }

      .brand {
        gap: 10px;
      }

      .brand-mark {
        width: 35px;
        height: 35px;
        font-size: 18px;
        border-radius: 8px;
      }

      .brand-name {
        font-size: 16px;
      }

      .brand-tagline {
        font-size: 11px;
      }

      .top-links {
        gap: 6px;
        font-size: 12px;
      }

      .bookmark-button {
        width: 30px;
        min-height: 28px;
        padding: 3px;
        border-radius: 5px;
      }

      .bookmark-label {
        display: none;
      }

      .bookmark-icon {
        font-size: 17px;
      }

      .bookmark-toast {
        top: calc(100% + 6px);
        max-width: min(250px, calc(100vw - 28px));
      }

      .language-button {
        min-height: 28px;
        padding: 3px 6px;
        font-size: 12px;
        border-radius: 5px;
      }

      .language-menu {
        max-height: min(70vh, 480px);
      }

      .language-option {
        min-height: 40px;
        padding: 10px 12px;
        font-size: 14px;
      }

      .search-area {
        padding: 0px 0 0px;
      }

      .search-form {
        --search-button-width: 58px;
        border-radius: 6px;
      }

      .search-input {
        height: 35px;
        padding: 0 41px 0 10px;
        font-size: 14px;
      }

      .search-clear {
        width: 28px;
        height: 28px;
        font-size: 19px;
        line-height: 1;
      }

      .search-button {
        font-size: 13px;
      }

      .direct-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        margin: 0;
        padding: 5px 2px;
        border-radius: 6px;
      }

      .direct-site {
        gap: 3px;
        min-height: 62px;
        padding: 5px 1px;
        font-size: 11px;
        line-height: 1.15;
      }

      .direct-favicon {
        width: 30px;
        height: 30px;
        padding: 2px;
        border-radius: 7px;
      }

      .directory {
        padding: 0px 0 0px;
      }

      .directory-panel {
        border-radius: 6px;
      }

      .category-name {
        min-height: 39px;
        padding: 8px 5px;
        font-size: 13px;
      }

      /* .category-name::before {
        width: 3px;
        height: 16px;
        margin-right: 7px;
      } */

      .category-caret {
        /* width: 29px;
        height: 29px; */
        font-size: 30px;
      }

      .category-row--enhanced .category-caret::after {
        right: auto;
        left: 0;
        transform: translate(0, 3px);
      }

      .category-row--enhanced .category-caret.is-tooltip-visible::after {
        transform: translate(0, 0);
      }

      .category-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-left: 0px;
      }

      .site-link {
        padding: 11px 8px;
        font-size: 13px;
      }

      .site-link::before {
        width: 4px;
        height: 4px;
        margin-right: 6px;
      }

      .category-links .site-link:nth-child(n + 3) {
        border-top: 1px solid #edf1f3;
      }

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

      .site-item {
        min-height: 47px;
        padding: 8px;
      }

      .site-item:nth-child(n) {
        border-right: 1px solid var(--line);
      }

      .site-item:nth-child(2n) {
        border-right: 0;
      }

      .site-dot {
        width: 23px;
        height: 23px;
        margin-right: 7px;
        font-size: 10px;
        border-radius: 5px;
      }

      .site-item strong {
        font-size: 13px;
      }

      .site-item small {
        font-size: 10px;
      }

      .guides-line {
        gap: 4px 9px;
        margin-top: 18px;
        padding: 10px 11px;
        font-size: 12px;
        line-height: 1.7;
      }

      .guides-line a::before {
        margin-right: 9px;
      }

      .footer {
        margin-top: 0px;
      }

      .footer-inner {
        width: min(100% - 28px, var(--max));
        padding: 0px 0 0px;
      }

      .footer-nav,
      .footer-links {
        gap: 8px;
      }

      .footer-nav a,
      .footer-links a {
        min-height: 34px;
        padding: 7px 11px;
        font-size: 12px;
      }

      .footer-links {
        margin-top: 0px;
        padding: 0px 8px;
      }

      .footer-note,
      .footer-disclosure,
      .footer-copy {
        font-size: 13px;
        line-height: 1.7;
      }

      .footer-note {
        margin-top: 0px;
      }

      .footer-disclosure {
        margin-top: 10px;
      }

      .footer-copy {
        margin-top: 14px;
        font-size: 12px;
      }
    }

    /* 极窄手机保留四列，避免站点名称被压缩到难以辨认。 */
    @media (max-width: 390px) {
      .direct-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
      }

      .direct-site {
        min-height: 60px;
      }

      .direct-favicon {
        width: 29px;
        height: 29px;
      }
    }
