:root {
  --bg: #f6f8ff;
  --surface: rgba(255,255,255,.82);
  --surface-solid: #ffffff;
  --text: #1e2433;
  --muted: #7e879c;
  --line: rgba(91,106,145,.14);
  --primary: #6378f4;
  --primary-2: #8e6cf3;
  --primary-soft: #eef1ff;
  --shadow: 0 18px 60px rgba(63,76,130,.10);
  --shadow-sm: 0 8px 28px rgba(63,76,130,.08);
  --radius: 22px;
}

body.dark {
  --bg: #111522;
  --surface: rgba(27,32,48,.85);
  --surface-solid: #1b2030;
  --text: #edf0fb;
  --muted: #a1a9bd;
  --line: rgba(255,255,255,.09);
  --primary: #8b9af9;
  --primary-2: #a784f8;
  --primary-soft: rgba(114,131,246,.14);
  --shadow: 0 18px 60px rgba(0,0,0,.24);
  --shadow-sm: 0 8px 28px rgba(0,0,0,.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background .25s ease, color .25s ease;
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.ambient { position: fixed; border-radius: 50%; filter: blur(15px); pointer-events: none; z-index: -1; opacity: .55; }
.ambient-one { width: 420px; height: 420px; top: -160px; left: -120px; background: radial-gradient(circle, rgba(143,174,255,.35), transparent 68%); }
.ambient-two { width: 520px; height: 520px; top: 100px; right: -220px; background: radial-gradient(circle, rgba(202,157,255,.24), transparent 68%); }

.site-header {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, #7188ff, #9d7af6); color: #fff; box-shadow: 0 10px 26px rgba(100,120,244,.28);
}
.brand-mark svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-size: 17px; line-height: 1.15; letter-spacing: .02em; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.header-actions { display: flex; gap: 9px; align-items: center; }
.ghost-btn, .ghost-link {
  height: 40px; min-width: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); color: var(--muted);
  background: var(--surface); backdrop-filter: blur(14px); display: inline-flex; align-items: center; justify-content: center;
  transition: .2s ease;
}
.ghost-btn:hover, .ghost-link:hover { transform: translateY(-1px); border-color: rgba(99,120,244,.35); color: var(--primary); }

main { width: min(1080px, calc(100% - 36px)); margin: 0 auto; }
.hero { text-align: center; padding: 80px 0 54px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--primary-soft);
  color: var(--primary); font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.hero h1 { margin: 18px 0 12px; font-size: clamp(38px, 6vw, 62px); letter-spacing: -.045em; line-height: 1.08; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }

.search-box {
  width: min(760px, 100%); margin: 34px auto 0; padding: 8px; display: flex; align-items: center; gap: 6px;
  background: var(--surface-solid); border: 1px solid var(--line); border-radius: 19px; box-shadow: var(--shadow); position: relative;
}
.search-box:focus-within { border-color: rgba(99,120,244,.45); box-shadow: 0 20px 65px rgba(82,99,190,.14), 0 0 0 4px rgba(99,120,244,.07); }
.search-icon { width: 42px; display: grid; place-items: center; color: #9aa3b8; flex: 0 0 42px; }
.search-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search-box input { flex: 1; min-width: 0; height: 46px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 15px; }
.search-box input::placeholder { color: #a9b0bf; }
.search-button {
  height: 46px; min-width: 92px; padding: 0 22px; border: 0; border-radius: 13px; color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 9px 22px rgba(99,120,244,.25); transition: .2s ease;
}
.search-button:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(99,120,244,.32); }
.search-button:active { transform: translateY(0); }
.quick-search { margin-top: 15px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; }
.quick-search button { border: 0; padding: 5px 8px; border-radius: 8px; color: var(--muted); background: transparent; transition: .18s ease; }
.quick-search button:hover { color: var(--primary); background: var(--primary-soft); }

.result-panel {
  background: var(--surface); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow-sm);
  padding: 24px; margin-bottom: 60px;
}
.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 3px 4px 20px; }
.result-toolbar h2 { margin: 0; font-size: 18px; }
.result-toolbar p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.toolbar-controls { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.select-wrap { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.select-wrap select { height: 36px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface-solid); padding: 0 30px 0 11px; outline: none; }

.cloud-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 17px; scrollbar-width: none; }
.cloud-tabs::-webkit-scrollbar { display: none; }
.cloud-tab {
  flex: 0 0 auto; border: 1px solid var(--line); height: 36px; border-radius: 11px; padding: 0 13px; color: var(--muted); background: var(--surface-solid); transition: .18s ease; font-size: 12px;
}
.cloud-tab:hover { color: var(--primary); border-color: rgba(99,120,244,.3); }
.cloud-tab.active { color: var(--primary); border-color: rgba(99,120,244,.2); background: var(--primary-soft); font-weight: 600; }
.cloud-tab .count { margin-left: 5px; opacity: .72; }

.result-list { display: grid; gap: 11px; }
.result-card {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 17px;
  border: 1px solid var(--line); border-radius: 17px; background: var(--surface-solid); transition: .2s ease;
}
.result-card:hover { transform: translateY(-1px); border-color: rgba(99,120,244,.26); box-shadow: 0 12px 30px rgba(61,75,125,.07); }
.disk-logo { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; }
.disk-logo.quark { background: linear-gradient(135deg, #746cff, #877efb); }
.disk-logo.baidu { background: linear-gradient(135deg, #4187ff, #2766e8); }
.disk-logo.aliyun { background: linear-gradient(135deg, #ff8c4d, #ff6e3c); }
.disk-logo.xunlei { background: linear-gradient(135deg, #4ab7ff, #2889ef); }
.disk-logo.pan115 { background: linear-gradient(135deg, #31b977, #1b9d64); }
.disk-logo.uc { background: linear-gradient(135deg, #ffb73c, #ff9045); }
.disk-logo.other { background: linear-gradient(135deg, #8f9aad, #67738a); }
.result-main { min-width: 0; }
.result-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { margin-top: 7px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; color: var(--muted); font-size: 11px; }
.result-meta span { display: inline-flex; align-items: center; gap: 4px; }
.pwd { color: var(--primary); background: var(--primary-soft); padding: 2px 7px; border-radius: 6px; }
.result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.action-btn {
  height: 40px;
  min-width: 60px;
  padding: 0 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(127, 138, 170, .035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}
.action-btn:hover {
  color: var(--text);
  border-color: rgba(99,120,244,.28);
  background: var(--primary-soft);
  transform: translateY(-1px);
}
.action-btn:active { transform: translateY(0); }
.action-btn.open {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 7px 18px rgba(99,120,244,.20);
}
.action-btn.open:hover {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 9px 22px rgba(99,120,244,.28);
  filter: brightness(1.04);
}

.empty-state { text-align: center; padding: 60px 20px 66px; color: var(--muted); }
.empty-icon { width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 28px; background: var(--primary-soft); color: var(--primary); }
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 15px; }
.empty-state p { margin: 0; font-size: 12px; }

footer { width: min(1080px, calc(100% - 36px)); margin: -30px auto 30px; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.7; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 18px); padding: 10px 15px; border-radius: 10px; background: rgba(25,30,43,.92); color: #fff; font-size: 12px; opacity: 0; pointer-events: none; transition: .22s ease; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .site-header { height: 72px; width: min(100% - 24px, 1180px); }
  .brand small, .ghost-link { display: none; }
  main { width: min(100% - 22px, 1080px); }
  .hero { padding: 52px 0 38px; }
  .hero h1 { font-size: 38px; }
  .hero p { padding: 0 16px; font-size: 13px; line-height: 1.7; }
  .search-box { margin-top: 25px; border-radius: 16px; padding: 6px; }
  .search-icon { width: 34px; flex-basis: 34px; }
  .search-button { min-width: 72px; padding: 0 14px; }
  .quick-search { padding: 0 12px; }

  .result-panel {
    padding: 15px;
    border-radius: 22px;
  }
  .result-toolbar {
    align-items: flex-start;
    padding: 3px 2px 16px;
  }
  .toolbar-controls { gap: 7px; flex-wrap: nowrap; }
  .select-wrap > span { display: none; }
  .select-wrap select { max-width: 118px; padding-left: 10px; }

  .result-list { gap: 12px; }
  .result-card {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas:
      "logo main"
      "actions actions";
    column-gap: 12px;
    row-gap: 11px;
    align-items: start;
    padding: 16px;
    border-radius: 18px;
  }
  .disk-logo {
    grid-area: logo;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    margin-top: 1px;
  }
  .result-main { grid-area: main; }
  .result-title {
    font-size: 14px;
    line-height: 1.5;
    white-space: normal;
    overflow: hidden;
    text-overflow: initial;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-break: break-word;
  }
  .result-meta {
    margin-top: 6px;
    gap: 5px 10px;
    line-height: 1.55;
  }
  .result-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 9px;
    margin-top: 1px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }
  .action-btn {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 12px;
  }
  .action-btn.open { box-shadow: 0 6px 16px rgba(99,120,244,.18); }

  /* Touch screens should not keep desktop hover movement. */
  .result-card:hover,
  .action-btn:hover,
  .search-button:hover,
  .ghost-btn:hover,
  .ghost-link:hover {
    transform: none;
  }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 34px; }
  .search-box input { font-size: 14px; }
  .result-panel { padding: 12px; }
  .result-card { padding: 14px; }
  .result-meta .source { display: none; }
  .result-actions { gap: 8px; padding-top: 11px; }
  .action-btn { height: 39px; }
}

/* Real API state */
.search-button:disabled {
  cursor: wait;
  opacity: .78;
  transform: none;
}

.disk-logo.tianyi { background: linear-gradient(135deg, #32a8ff, #1978dc); }
.disk-logo.mobile { background: linear-gradient(135deg, #35c28a, #1a9c71); }
.disk-logo.pikpak { background: linear-gradient(135deg, #644df0, #8d6cf6); }
.disk-logo.pan123 { background: linear-gradient(135deg, #1ca6f5, #1269d3); }
.disk-logo.guangya { background: linear-gradient(135deg, #ffad4b, #f17a3a); }
.disk-logo.magnet { background: linear-gradient(135deg, #e15a66, #bd3746); }
.disk-logo.ed2k { background: linear-gradient(135deg, #7b879a, #556174); }

.skeleton-card { pointer-events: none; }
.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(127, 138, 170, .12);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.20), transparent);
  animation: skeleton-shimmer 1.25s infinite;
}
.skeleton-logo { width: 42px; height: 42px; border-radius: 13px; }
.skeleton-main { min-width: 0; }
.skeleton-title { width: min(440px, 75%); height: 14px; border-radius: 7px; margin: 2px 0 10px; }
.skeleton-meta { width: min(320px, 58%); height: 10px; border-radius: 6px; }
.skeleton-actions { width: 132px; height: 40px; border-radius: 12px; }

@keyframes skeleton-shimmer {
  100% { transform: translateX(100%); }
}

@media (max-width: 720px) {
  .skeleton-logo { grid-area: logo; width: 44px; height: 44px; }
  .skeleton-main { grid-area: main; }
  .skeleton-actions { grid-area: actions; width: 100%; height: 40px; margin-top: 12px; }
  .skeleton-title { width: 86%; }
  .skeleton-meta { width: 68%; }
}

@media (max-width: 420px) {
  .result-toolbar { flex-direction: column; gap: 12px; }
  .toolbar-controls { width: 100%; }
  .select-wrap { flex: 1; }
  .select-wrap select { width: 100%; max-width: none; }
}

/* Link validity checker */
.link-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.55;
  white-space: nowrap;
}
.link-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}
.status-waiting {
  color: var(--muted);
  background: rgba(127, 138, 170, .08);
  border-color: var(--line);
}
.status-checking {
  color: #6d7ee8;
  background: rgba(99, 120, 244, .09);
  border-color: rgba(99, 120, 244, .13);
}
.status-checking::before {
  animation: link-status-pulse .9s ease-in-out infinite alternate;
}
.status-ok {
  color: #25976a;
  background: rgba(37, 151, 106, .09);
  border-color: rgba(37, 151, 106, .14);
}
.status-bad {
  color: #d85a64;
  background: rgba(216, 90, 100, .09);
  border-color: rgba(216, 90, 100, .15);
}
.status-locked {
  color: #c88925;
  background: rgba(200, 137, 37, .10);
  border-color: rgba(200, 137, 37, .16);
}
.status-uncertain,
.status-error,
.status-unsupported {
  color: #8b779d;
  background: rgba(139, 119, 157, .09);
  border-color: rgba(139, 119, 157, .14);
}
.result-card.link-invalid {
  opacity: .64;
  border-color: rgba(216, 90, 100, .16);
  background: color-mix(in srgb, var(--surface-solid) 96%, #d85a64 4%);
}
.result-card.link-invalid:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(216, 90, 100, .20);
}
.action-btn:disabled {
  cursor: not-allowed;
  opacity: .48;
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
}
.action-btn.open:disabled {
  color: var(--muted);
  background: rgba(127, 138, 170, .08);
  border-color: var(--line);
}

@keyframes link-status-pulse {
  from { opacity: .30; transform: scale(.82); }
  to { opacity: 1; transform: scale(1.18); }
}

@media (max-width: 720px) {
  .link-status {
    padding: 2px 6px;
    font-size: 10px;
  }
}
