/* ============================================================
   极界盘搜 · 样式
   结构：变量 → 基础 → 背景 → 头部 → 搜索区 → 状态区 → 结果卡片
        → 设置弹窗 → 提示 → 页脚 → 响应式 → 动效偏好
   ========================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  --bg: #06090f;
  --bg-soft: #0a0f1a;
  --panel: rgba(255, 255, 255, 0.042);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eefb;
  --text-soft: #a9b4cc;
  --muted: #79859e;
  --accent: #46e0ff;
  --accent-2: #7b6bff;
  --ok: #3ee0a5;
  --warn: #ffb84d;
  --err: #ff6b81;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.9);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  /* 各网盘主色 */
  --tone-baidu: #3b7dff;
  --tone-aliyun: #ff7a45;
  --tone-quark: #3f8cff;
  --tone-uc: #ff9a3d;
  --tone-115: #33c17a;
  --tone-xunlei: #3fa9f5;
  --tone-123: #ff5b5b;
  --tone-tianyi: #31b6e8;
  --tone-mobile: #2f7fee;
  --tone-guangya: #f0b429;
  --tone-pikpak: #6f5cff;
  --tone-magnet: #9aa8c7;
  --tone-ed2k: #8f9bb8;
  --tone-others: #78849e;
}

/* ---------- 2. 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  /* 竖向 flex：内容少时（首页初始态）把 footer 压到底部，
     避免中间删掉卡片后页面下方留一大块空黑。 */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

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

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

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

/* ---------- 3. 背景 ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 620px at 50% -12%, rgba(70, 224, 255, 0.1), transparent 62%),
    radial-gradient(900px 520px at 88% 8%, rgba(123, 107, 255, 0.1), transparent 60%),
    linear-gradient(180deg, #070b14 0%, #05080e 55%, #04060b 100%);
}

.backdrop-grid {
  position: absolute;
  inset: -1px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(900px 560px at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(900px 560px at 50% 0%, #000 0%, transparent 78%);
}

.backdrop-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
}

.backdrop-glow--a {
  top: -180px;
  left: 8%;
  background: rgba(70, 224, 255, 0.28);
  animation: drift 22s ease-in-out infinite alternate;
}

.backdrop-glow--b {
  top: -140px;
  right: 4%;
  background: rgba(123, 107, 255, 0.26);
  animation: drift 26s ease-in-out infinite alternate-reverse;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(40px, 30px, 0) scale(1.12);
  }
}

/* ---------- 4. 头部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* 背景必须铺满整个视口宽度：一旦用 max-width + auto margin，
     左右两侧就没有底色，滚动内容会从两侧透出来，看起来像一条没盖住的缝。
     内容宽度靠 padding 收回到 --maxw。 */
  width: 100%;
  padding: 18px max(24px, calc((100% - var(--maxw)) / 2 + 24px));
  background: linear-gradient(180deg, rgba(10, 15, 26, 0.98) 0%, var(--bg) 62%, var(--bg) 100%);
  border-bottom: 1px solid rgba(120, 170, 255, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 640;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: var(--accent);
  background: linear-gradient(145deg, rgba(70, 224, 255, 0.18), rgba(123, 107, 255, 0.16));
  border: 1px solid rgba(70, 224, 255, 0.28);
  box-shadow: 0 0 22px -6px rgba(70, 224, 255, 0.5);
}

.brand-name {
  font-size: 1.02rem;
}

/* ---------- 5. 搜索区 ---------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 72px;
  flex: 1 0 auto;
  width: 100%;
}

.hero {
  padding: clamp(28px, 7vw, 72px) 0 22px;
  text-align: center;
}

.hero-title {
  font-size: clamp(2.15rem, 6.2vw, 3.5rem);
  font-weight: 720;
  line-height: 1.12;
  letter-spacing: -0.012em;
  background: linear-gradient(96deg, #ffffff 6%, #b9e9ff 42%, #b7aaff 78%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-wrap: balance;
}

.hero-subtitle {
  margin-top: 12px;
  color: var(--text-soft);
  font-size: clamp(0.9rem, 2vw, 1rem);
}

/* 搜索态：收起大标题，把首屏让给结果 */
body.is-compact .hero {
  padding: 10px 0 4px;
}

body.is-compact .hero-title {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  letter-spacing: 0.02em;
}

body.is-compact .hero-subtitle {
  display: none;
}

body.is-compact .search-form {
  margin-top: 14px;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 720px;
  margin: 28px auto 0;
  padding: 7px 7px 7px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form:focus-within {
  border-color: rgba(70, 224, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(70, 224, 255, 0.1), var(--shadow);
}

.search-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 4px;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
}

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

.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  background: currentColor;
  opacity: 0.35;
  color: var(--muted);
  mask: linear-gradient(#000, #000);
  clip-path: polygon(
    32% 24%,
    50% 42%,
    68% 24%,
    76% 32%,
    58% 50%,
    76% 68%,
    68% 76%,
    50% 58%,
    32% 76%,
    24% 68%,
    42% 50%,
    24% 32%
  );
  cursor: pointer;
}

.search-submit {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  color: #021018;
  background: linear-gradient(135deg, var(--accent), #86f0ff 45%, var(--accent-2));
  box-shadow: 0 10px 26px -12px rgba(70, 224, 255, 0.85);
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}

.search-submit:hover:not(:disabled) {
  filter: brightness(1.07);
}

.search-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.search-submit:disabled {
  opacity: 0.75;
  cursor: progress;
}

.search-submit .spinner {
  display: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(2, 16, 24, 0.28);
  border-top-color: #021018;
  animation: spin 0.7s linear infinite;
}

.search-submit.is-loading .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 搜索历史 */
.history {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 720px;
  margin: 16px auto 0;
  padding: 0 4px;
}

.history[hidden] {
  display: none;
}

.history-label {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

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

.history-clear {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.18s, background 0.18s;
}

.history-clear:hover {
  color: var(--err);
  background: rgba(255, 107, 129, 0.08);
}

/* ---------- 6. 类型筛选 ---------- */
.type-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: var(--maxw);
  margin: 4px auto 22px;
}

.type-bar[hidden] {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--text-soft);
  background: var(--panel);
  border: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.16s, background 0.16s, border-color 0.16s, transform 0.16s;
}

.chip:hover {
  color: var(--text);
  background: var(--panel-strong);
  border-color: var(--border-strong);
}

.chip.is-active {
  color: #04141b;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(70, 224, 255, 0.95), rgba(123, 107, 255, 0.9));
  border-color: transparent;
}

.chip-count {
  font-size: 0.72rem;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.chip.is-active .chip-count {
  background: rgba(2, 16, 24, 0.22);
}

.chip--history {
  font-size: 0.8rem;
  padding: 5px 11px;
}

/* ---------- 7. 状态区 ---------- */
.results-area {
  min-height: 240px;
}

.state[hidden] {
  display: none;
}

/* 初始态：不渲染任何卡片，页面只留搜索框与历史 */
.state--idle:empty {
  display: none;
}

/* 加载态 */
.state--loading {
  padding-top: 10px;
}

.loading-text {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.skeleton-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.skeleton-card {
  height: 124px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.035) 20%,
    rgba(255, 255, 255, 0.075) 40%,
    rgba(255, 255, 255, 0.035) 60%
  );
  background-size: 220% 100%;
  animation: shimmer 1.35s linear infinite;
}

@keyframes shimmer {
  from {
    background-position: 140% 0;
  }
  to {
    background-position: -60% 0;
  }
}

/* 反馈卡片（错误 / 空结果） */
.feedback-card {
  max-width: 560px;
  margin: 24px auto 0;
  padding: 30px 26px;
  text-align: center;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
}

.feedback-card--error {
  border-color: rgba(255, 107, 129, 0.28);
  background: linear-gradient(180deg, rgba(255, 107, 129, 0.07), var(--panel));
}

.feedback-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border-radius: 14px;
  color: var(--err);
  background: rgba(255, 107, 129, 0.1);
  border: 1px solid rgba(255, 107, 129, 0.22);
}

.feedback-icon--muted {
  color: var(--text-soft);
  background: var(--panel-strong);
  border-color: var(--border);
}

.feedback-card h2 {
  font-size: 1.1rem;
  font-weight: 640;
}

.feedback-message {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.feedback-detail {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.7;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feedback-detail[hidden] {
  display: none;
}

.feedback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.feedback-tips {
  margin-top: 16px;
  text-align: left;
  color: var(--muted);
  font-size: 0.83rem;
}

.feedback-tips li {
  position: relative;
  padding-left: 16px;
  margin-top: 6px;
}

.feedback-tips li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--accent);
}

/* ---------- 8. 按钮 ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 560;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}

.button:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.1);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button--primary {
  color: #04141b;
  background: linear-gradient(135deg, var(--accent), #93f1ff 50%, var(--accent-2));
  border-color: transparent;
}

.button--primary:hover {
  background: linear-gradient(135deg, #63e6ff, #a8f5ff 50%, #8d7dff);
}

/* ---------- 9. 结果 ---------- */
.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 0 2px 16px;
  color: var(--muted);
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.meta-strong {
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.meta-dim {
  opacity: 0.72;
}

.meta-item + .meta-item::before {
  content: '';
}

.meta-action {
  margin-left: auto;
  padding: 4px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.meta-action:hover:not(:disabled) {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.meta-action:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

.meta-action:disabled {
  cursor: progress;
  opacity: 0.62;
}

.group {
  margin-bottom: 30px;
}

.group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.group-title {
  font-size: 0.95rem;
  font-weight: 640;
  letter-spacing: 0.01em;
}

.group-count {
  color: var(--muted);
  font-size: 0.76rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(316px, 1fr));
  gap: 12px;
}

.result-card {
  --tone: var(--tone-others);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 16px 13px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.022));
  border: 1px solid var(--border);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}

.result-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--tone), transparent 85%);
  opacity: 0.85;
}

.result-card:hover {
  border-color: color-mix(in srgb, var(--tone) 42%, var(--border-strong));
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -24px rgba(0, 0, 0, 0.95);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.02em;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone) 30%, transparent);
}

.card-meta {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.card-source {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-time {
  flex: 0 0 auto;
  opacity: 0.86;
}

/* ---------- 9.1 链接检测徽章 ---------- */
.check-slot {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.check-chip {
  --chip-tone: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--chip-tone) 38%, transparent);
  background: color-mix(in srgb, var(--chip-tone) 13%, transparent);
  color: var(--chip-tone);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 620;
  line-height: 1.55;
  white-space: nowrap;
}

button.check-chip {
  cursor: pointer;
  color: var(--text-soft);
  border-color: var(--border-strong);
  background: transparent;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

button.check-chip:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

button.check-chip:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

.check-chip.is-pending {
  --chip-tone: var(--text-soft);
  cursor: progress;
}

.check-chip.is-pending::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

.check-chip.is-ok {
  --chip-tone: #46d39a;
}

.check-chip.is-bad {
  --chip-tone: #ff6b81;
}

.check-chip.is-warn {
  --chip-tone: #ffb648;
}

.check-chip.is-muted {
  --chip-tone: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .check-chip.is-pending::before {
    animation-duration: 2s;
  }
}

.card-title {
  font-size: 0.94rem;
  font-weight: 560;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 2px;
}

.card-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 0.79rem;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}

.card-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-strong);
}

.card-action--open {
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 12%, transparent);
  border-color: color-mix(in srgb, var(--tone) 30%, transparent);
  font-weight: 560;
}

.card-action--open:hover {
  color: #04141b;
  background: var(--tone);
  border-color: var(--tone);
}

.card-action--open .arrow {
  font-size: 0.82em;
  opacity: 0.8;
}

.card-action--pwd code {
  color: var(--accent);
  letter-spacing: 0.04em;
}

.load-more {
  display: block;
  width: 100%;
  margin-top: 10px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.83rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-strong);
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}

.load-more:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
  border-color: rgba(70, 224, 255, 0.4);
}

/* 各网盘 tone */
.tone-baidu { --tone: var(--tone-baidu); }
.tone-aliyun { --tone: var(--tone-aliyun); }
.tone-quark { --tone: var(--tone-quark); }
.tone-uc { --tone: var(--tone-uc); }
.tone-115 { --tone: var(--tone-115); }
.tone-xunlei { --tone: var(--tone-xunlei); }
.tone-123 { --tone: var(--tone-123); }
.tone-tianyi { --tone: var(--tone-tianyi); }
.tone-mobile { --tone: var(--tone-mobile); }
.tone-guangya { --tone: var(--tone-guangya); }
.tone-pikpak { --tone: var(--tone-pikpak); }
.tone-magnet { --tone: var(--tone-magnet); }
.tone-ed2k { --tone: var(--tone-ed2k); }
.tone-others { --tone: var(--tone-others); }

/* ---------- 10. 设置弹窗 ---------- */
/* ---------- 11. 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 50;
  transform: translate(-50%, 12px);
  max-width: calc(100vw - 40px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(16, 24, 40, 0.94);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

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

.toast[hidden] {
  display: block;
}

/* ---------- 12. 页脚 ---------- */
.site-footer {
  max-width: var(--maxw);
  margin: auto auto 0;
  padding: 28px 24px 40px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.75;
  text-align: center;
  width: 100%;
}

.footer-meta {
  margin-top: 4px;
  opacity: 0.72;
}

/* ---------- 13. 响应式 ---------- */
@media (max-width: 720px) {
  .page {
    padding: 0 16px 56px;
  }

  .site-header {
    padding: 14px 16px;
  }

  .hero {
    padding-top: 22px;
  }

  .search-form {
    padding: 6px 6px 6px 14px;
  }

  .search-submit {
    min-width: 78px;
    padding: 0 16px;
  }

  .card-grid,
  .skeleton-list {
    grid-template-columns: 1fr;
  }

  .type-bar {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .type-bar::-webkit-scrollbar {
    display: none;
  }

  .dialog-inner {
    padding: 18px 16px 14px;
  }

  .dialog-actions .button {
    flex: 1 1 auto;
  }

  .dialog-spacer {
    display: none;
  }
}

@media (max-width: 420px) {
  .search-input {
    font-size: 0.94rem;
  }

  .search-input::placeholder {
    font-size: 0.86rem;
  }

  .hero-title {
    font-size: 2rem;
  }
}

/* ---------- 14. 动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
 * 账号：顶栏入口 + 登录 / 注册 / 改密码弹窗
 * ========================================================== */

.auth-slot {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.auth-entry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text-soft);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.auth-entry:hover {
  color: var(--text);
  border-color: rgba(70, 224, 255, 0.45);
  background: rgba(70, 224, 255, 0.08);
}

.auth-entry--user {
  padding: 5px 14px 5px 6px;
}

.auth-avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #041016;
  font-weight: 700;
  font-size: 0.78rem;
}

.auth-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu {
  position: relative;
}

.auth-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 168px;
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: rgba(10, 15, 26, 0.98);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  display: none;
  z-index: 40;
}

.auth-slot.is-open .auth-dropdown {
  display: block;
}

.auth-dropdown-meta {
  padding: 6px 10px 8px;
  color: var(--muted);
  font-size: 0.74rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.auth-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.auth-dropdown-item:hover {
  background: var(--panel-strong);
  color: var(--text);
}

.auth-dropdown-item--danger:hover {
  background: rgba(255, 107, 129, 0.12);
  color: #ffc1ca;
}

/* ---------------- 弹窗 ---------------- */

.auth-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(16, 22, 36, 0.99), rgba(8, 12, 20, 0.99));
  color: var(--text);
  box-shadow: var(--shadow);
}

.auth-dialog::backdrop {
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(6px);
}

.auth-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px 24px;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-header h2 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 680;
  letter-spacing: 0.01em;
}

.auth-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.auth-close:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.auth-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 7px 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.auth-tab.is-active {
  background: linear-gradient(135deg, rgba(70, 224, 255, 0.9), rgba(123, 107, 255, 0.85));
  color: #04121a;
  font-weight: 640;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.auth-field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.auth-field input::placeholder {
  color: rgba(121, 133, 158, 0.72);
}

.auth-field input:focus {
  border-color: rgba(70, 224, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(70, 224, 255, 0.12);
}

.auth-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

.auth-error {
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 107, 129, 0.35);
  background: rgba(255, 107, 129, 0.1);
  color: #ffc1ca;
  font-size: 0.82rem;
}

.auth-submit {
  padding: 12px 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a;
  font-size: 0.94rem;
  font-weight: 680;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.16s ease, opacity 0.16s ease;
}

.auth-submit:hover:not(:disabled) {
  filter: brightness(1.08);
}

.auth-submit:disabled {
  opacity: 0.62;
  cursor: default;
}

.auth-foot {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 0 2px;
}

.auth-link:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .auth-inner {
    padding: 18px 18px 20px;
  }
  .auth-name {
    max-width: 84px;
  }
}

/* hidden 兜底：作者样式里的 display:flex 之类会盖掉浏览器默认的 [hidden]{display:none}，
   导致本该隐藏的字段反而显示出来。加一条 !important 规则统一兜住。 */
[hidden] {
  display: none !important;
}
