/* ==========================================================================
   全盘搜索 · 基础样式
   ========================================================================== */

:root {
  --brand: #6d81e2;
  --brand-deep: #5268ff;
  --grad-1: #d965ff;
  --grad-2: #658eff;
  --grad-3: #28c566;

  --text: #464646;
  --text-strong: #1f2937;
  --text-weak: #6b7280;
  --text-muted: #9ca3af;

  --border: #e5e7ed;
  --bg-soft: #f7fcff;
  --bg-tab: #e5e7ed;
  --bg-btn: #edf3ff;
  --bg-btn-h1: #4577fc;
  --bg-btn-h2: #2356dc;

  --ok: #15803d;
  --bad: #d53131;
  --warn: #f39c12;

  --container: 900px;
  --gutter: 16px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --ease-pop: cubic-bezier(.2,.7,.3,1);
}

*, ::before, ::after { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  line-height: 1.6;
  font-size: 14px;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-touch-callout: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
}

input, button, textarea, select {
  outline: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

button { cursor: pointer; }
/* 去掉移动端 300ms 点击延迟与双击缩放干扰（仍允许双指缩放） */
button, a, .tab-item, .link-item, .suggest-item { touch-action: manipulation; }
ul, li { list-style: none; margin: 0; padding: 0; }
img { border: none; max-width: 100%; }
a { text-decoration: none; color: var(--text); }

.icon, .ic {
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1;
  vertical-align: -.125em;
  fill: currentColor;
  flex-shrink: 0;
}

.ic use { pointer-events: none; }

/* --------------------------------------------------------------------------
   容器
   -------------------------------------------------------------------------- */
main {
  margin: 0 auto;
  flex: 1 0 auto;
}

.home {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  padding: 0 var(--gutter);
  margin: 0 auto;
}

/* 键盘可达性：鼠标点击不显示，Tab 聚焦才显示 */
:focus-visible {
  outline: 2px solid var(--brand-deep);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   顶栏（品牌 + 搜索）：结果页吸附在顶部，随时可改词
   -------------------------------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 60;
}

body.page-result .topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 10px var(--gutter);
  background: rgba(255, 255, 255, .93);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 1px 0 var(--border), 0 6px 18px rgba(15, 23, 42, .04);
}

body.page-result .brand {
  flex: 0 0 auto;
  height: auto;
  margin: 0;
  overflow: visible;
}

body.page-result .brand .brand-logo {
  display: block;
  width: 40px;
  transition: width .25s ease;
}

body.page-result .brand .brand-logo a {
  display: block;
  padding: 3px;
  margin: -3px;
  border-radius: 14px;
}
body.page-result .brand .brand-logo a:hover { background: #f1f4fb; }

body.page-result .brand .brand-slogan,
body.page-result .brand .brand-subtitle { display: none; }

body.page-result .search {
  flex: 1 1 auto;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   品牌区
   -------------------------------------------------------------------------- */
.brand {
  display: grid;
  justify-items: center;
  align-items: center;
  /* 关键：不设 align-content 时网格行会被拉伸，标语与副标题之间会出现大片空隙 */
  align-content: center;
  position: relative;
  height: clamp(160px, 26vh, 260px);
  margin-bottom: clamp(16px, 2.4vh, 28px);
  transition: height .35s ease, margin-bottom .35s ease;
  overflow: hidden;
}

.brand-logo { display: none; width: 180px; }
.brand-logo img { width: 100%; display: block; }

.brand-slogan {
  margin: 18px 0 0;
  color: #222;
  font-size: clamp(24px, 2.4vw, 40px);
  font-weight: 900;
  letter-spacing: .5px;
  text-align: center;
  white-space: nowrap;
}

.brand-slogan-strong {
  position: relative;
  padding-bottom: 5px;
  background-image: linear-gradient(135deg, #cf54f7, #507dff, #19bc12);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.brand-slogan-strong::after {
  content: '';
  position: absolute;
  left: -40%;
  bottom: 0;
  width: 100%;
  height: 15px;
  background: url(../img/wave.svg) no-repeat right 95%;
  background-size: 60%;
  opacity: .9;
}

.brand-subtitle { margin-top: 18px; text-align: center; }

.brand-subtitle-item {
  display: inline-block;
  padding: 0 10px;
  font-size: 15px;
  color: #555;
}

.brand-subtitle-item .icon {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  padding: 3px;
  border-radius: 50%;
  border: 1px solid #b8d9b9;
  color: #1a9e3a;
  vertical-align: -3px;
}

.brand.shrink,
body.page-searching .brand {
  height: 110px;
  margin-bottom: 18px;
}

.brand.shrink .brand-logo,
body.page-searching .brand-logo { display: inline-block; width: 64px; }

.brand.shrink .brand-slogan,
body.page-searching .brand-slogan { display: none; }

.brand.shrink .brand-subtitle,
body.page-searching .brand-subtitle { display: none; }

/* --------------------------------------------------------------------------
   搜索框
   -------------------------------------------------------------------------- */
.search {
  position: relative;
  z-index: 20;
}

.search-form {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 50px;
  padding: 2px;
  background: #fff;
  border: 2px solid var(--brand);
  border-radius: var(--radius-lg);
  transition: background .3s, box-shadow .3s, border-color .2s;
}

.search-form:hover { background: #f4faff; }

.search-form:focus-within {
  box-shadow: 0 6px 24px rgba(109, 129, 226, .18);
  background: #fff;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--text-strong);
  background: transparent;
}

.search-input::placeholder { color: #a8b0bd; }

.search-clear {
  flex-shrink: 0;
  align-self: center;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 2px;
  color: #9ca3af;
  border-radius: 50%;
  transition: color .2s, background .2s;
}
.search-clear[hidden] { display: none; }
.search-clear .icon { width: 18px; height: 18px; }
.search-clear:hover { color: #4b5563; background: #f3f5f9; }

.search-btn {
  flex-shrink: 0;
  width: 50px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--brand-deep);
  transition: background .2s;
}
.search-btn:hover { background: #f4f7ff; }
.search-btn:active { background: #e9efff; }

.search-btn .icon { width: 20px; height: 20px; }

.search-btn:hover .icon {
  color: transparent;
  background-image: linear-gradient(135deg, var(--grad-1), var(--grad-2), var(--grad-3));
  -webkit-background-clip: text;
  background-clip: text;
  transition: all .3s;
}

.search-btn[disabled] { cursor: default; }

/* 搜索按钮里的转圈 */
.loader {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background:
    radial-gradient(farthest-side, #28c566 100%, transparent) top no-repeat,
    conic-gradient(transparent 30%, #d965ff, #658eff);
  background-size: 7px 7px, 100% 100%;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0);
  animation: spin-ring .5s linear infinite;
}

@keyframes spin-ring { to { transform: rotate(1turn); } }

/* --------------------------------------------------------------------------
   搜索联想
   -------------------------------------------------------------------------- */
.suggest-box {
  position: absolute;
  top: calc(100% + 8px);
  left: -2px;
  right: -2px;
  z-index: 100;
  max-height: 430px;
  overflow-y: auto;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
}

.suggest-box[hidden] { display: none; }

.suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--text-strong);
  cursor: pointer;
  transition: background .12s;
}

.suggest-item .ic { color: #8b93a1; }
.suggest-item:hover, .suggest-item.active { background: rgba(0, 0, 0, .035); color: var(--brand-deep); }
.suggest-item:hover .ic, .suggest-item.active .ic { color: var(--brand-deep); }

.suggest-word {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   加载跑马灯
   -------------------------------------------------------------------------- */
.search-loading {
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.search-loading[hidden] { display: none; }

.loading {
  position: relative;
  width: 250px;
  height: 80px;
  margin: 0 auto 10px;
  padding: 15px;
  overflow: hidden;
}

.loading::before, .loading::after {
  content: '';
  position: absolute;
  top: 0;
  width: 60px;
  height: 100%;
  z-index: 2;
}
.loading::before { left: 0; background: linear-gradient(to left, transparent, #fff 90%); }
.loading::after { right: 0; background: linear-gradient(to right, transparent, #fff 90%); }

.loading-box {
  display: flex;
  gap: 5px;
  width: max-content;
  animation: belt-move 8.8s linear infinite;
}

.loading-dot {
  width: 48px;
  height: 48px;
  padding: 13px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
}
.loading-dot img { width: 100%; height: 100%; object-fit: contain; }

@keyframes belt-move {
  from { transform: translateX(0); }
  to   { transform: translateX(-583px); }
}

.loading-text {
  padding: 8px 30px;
  font-size: 15px;
  font-weight: 700;
  color: #4b5563;
  border: 1px solid var(--border);
  border-radius: 50px;
}

/* --------------------------------------------------------------------------
   结果区
   -------------------------------------------------------------------------- */
.result-main { padding-top: 18px; }
.result-main[hidden] { display: none; }

.result-meta {
  font-size: 13px;
  color: var(--text-weak);
  min-height: 18px;
}
.result-meta strong { color: var(--text-strong); font-weight: 700; }

.tabbar { position: relative; margin: 0 calc(-1 * var(--gutter)); }

/* 左右渐隐：真溢出时由 JS 给 .tabbar 加类；覆盖层比 mask 在滚动容器里更可靠 */
.tabbar::before,
.tabbar::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.tabbar::before { left: 0; background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0)); }
.tabbar::after { right: 0; background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0)); }
.tabbar.fade-left::before { opacity: .96; }
.tabbar.fade-right::after { opacity: .96; }

.tab-box {
  display: flex;
  align-items: stretch;
  padding: 12px var(--gutter) 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-box::-webkit-scrollbar { display: none; }

.tab-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 5px;
  padding: 6px 11px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tab);
  white-space: nowrap;
  transition: background .2s, border-color .2s;
}

.tab-item.active {
  color: #000;
  background: #fff;
  border-color: #e8e8e8;
}

.tab-item:not(.active) { cursor: pointer; }
.tab-item:not(.active):hover { background: #fff; }

.tab-name { font-size: 16px; color: #505050; }
.tab-item.active .tab-name { font-weight: 700; color: #202020; }

.tab-count {
  display: block;
  width: 12px;
  height: 3px;
  margin: 2px 0 0 2px;
  font-size: 0;
  line-height: 1;
  border-radius: 10px;
  background: #cacaca;
  transition: background .2s;
}
.tab-item.active .tab-count, .tab-item:hover .tab-count { background: var(--c, #cacaca); }

.tabpanel { min-height: 200px; }

/* 结果项 */
.link-item {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  overflow: hidden;
  transition: background .2s, opacity .25s, border-color .2s;
}

@media (hover: hover) {
  .link-item:hover { background: var(--bg-soft); border-color: #dbe4f5; }
}
.link-item:active { background: var(--bg-soft); }
.link-item:focus-visible { outline: 2px solid var(--brand-deep); outline-offset: -2px; }

.link-type {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
}
.link-type img { width: 65%; height: 65%; object-fit: contain; }
.link-type.fallback {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.link-body { flex: 1; min-width: 0; }

.link-note {
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  transition: color .12s;
}
.link-item:hover .link-note { color: #2356dc; }

.link-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.link-tag {
  padding: 6px 7px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  border-radius: 5px;
  background: #f1f3f5;
  color: #5b6370;
  white-space: nowrap;
}

.tag-reso { background: #eaf1ff; color: #2356dc; }
.tag-quality { background: #fff0f0; color: #cd3535; }
.tag-year { background: #f8f0de; color: #b35e27; }
.tag-ep { background: #f3ecff; color: #7c3aed; }
.tag-fps { background: #fdeef6; color: #c026a3; }
.tag-codec { background: #eafaf1; color: #1e874b; }
.tag-audio { background: #e7f7f8; color: #0e7c86; }
.tag-lang { background: #eef1f6; color: #4b5670; }

.link-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1;
  color: var(--text-weak);
}

.link-meta .link-time {
  padding-left: 10px;
  border-left: 2px solid #ddd;
}

.link-actions { flex-shrink: 0; }
.link-state { flex-shrink: 0; }

.btn-primary {
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--bg-btn);
  color: #2356dc;
  transition: background .25s, color .25s;
}
.btn-primary:hover { background: linear-gradient(135deg, var(--bg-btn-h1), var(--bg-btn-h2)); color: #fff; }
.btn-primary[disabled] { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; }

.state {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 50px;
  white-space: nowrap;
}
.state .ic { width: 11px; height: 11px; margin-right: 2px; }
.state-pending, .state-uncertain { color: #505050; background: #f7f8f9; }
.state-checking { color: var(--ok); }
.state-ok { color: var(--ok); background: linear-gradient(90deg, #e0fde0, transparent); }
.state-bad { color: var(--bad); background: linear-gradient(90deg, #ffebeb, transparent); }
.state-suspect { color: var(--warn); background: linear-gradient(90deg, #fef5e7, transparent); }

.link-item.suspect { opacity: .62; }
.link-item.suspect .link-note { text-decoration: line-through; text-decoration-color: #d1d5db; }
.link-item.suspect .link-type { filter: grayscale(.6); }

/* 加载更多 */
.load-more-sentinel {
  padding: 18px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* 空态 / 错误态 */
.empty, .error-box {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-weak);
}
.error-box { padding: 40px 20px; }

.empty-title { margin-bottom: 6px; font-size: 16px; font-weight: 700; color: var(--text-strong); }
.empty-tip { font-size: 13px; color: var(--text-muted); }

.error-title { margin-bottom: 8px; font-weight: 600; color: var(--text-strong); }
.error-msg { font-size: 13px; line-height: 1.6; color: #991b1b; word-break: break-all; }

.tab-empty { padding: 60px 20px; text-align: center; font-size: 14px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   详情弹层
   -------------------------------------------------------------------------- */
.transfer-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in .2s ease-out;
}
.transfer-modal[hidden] { display: none; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.transfer-modal-box {
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
  animation: pop-in .25s var(--ease-pop);
}

@keyframes pop-in {
  from { transform: translateY(16px) scale(.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.transfer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
  background: #fff;
}

.transfer-title { font-size: 16px; font-weight: 600; color: var(--text-strong); }

.transfer-close {
  width: 36px;
  height: 36px;
  margin: -4px -6px -4px 0;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.transfer-close:hover { background: #f3f4f6; color: var(--text-strong); }

.transfer-body { padding: 8px 26px 28px; }

/* 进度 */
.tp-status { padding: 6px 0 14px; text-align: center; }
.tp-spinner { display: inline-flex; gap: 5px; margin-bottom: 8px; }
.tp-spinner span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #2356dc;
  animation: tp-bounce 1s infinite ease-in-out;
}
.tp-spinner span:nth-child(2) { animation-delay: .15s; }
.tp-spinner span:nth-child(3) { animation-delay: .3s; }
@keyframes tp-bounce {
  0%, 80%, 100% { transform: scale(.5); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}

.tp-text { font-size: 15px; font-weight: 600; color: var(--text-strong); }
.tp-sub { margin-top: 6px; font-size: 12px; line-height: 1.6; color: var(--text-muted); }

.tp-bar {
  height: 8px;
  margin: 14px 0 6px;
  border-radius: 999px;
  background: #eef2f6;
  overflow: hidden;
}
.tp-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: #5dd240;
  transition: width .6s ease;
}

.tp-stages { display: flex; justify-content: space-between; margin: 16px 4px 4px; }
.tp-stage { flex: 1; text-align: center; position: relative; }
.tp-stage::before {
  content: '';
  position: absolute;
  top: 13px; left: -50%; width: 100%; height: 2px;
  background: #eef2f6;
}
.tp-stage:first-child::before { display: none; }
.tp-stage.done::before, .tp-stage.active::before { background: #a7e8a0; }
.tp-stage b {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  font-size: 12px;
  border-radius: 50%;
  background: #eef2f6;
  color: #9ca3af;
}
.tp-stage.done b { background: #5dd240; color: #fff; }
.tp-stage.active b { background: #5dd240; color: #fff; box-shadow: 0 0 0 4px rgba(93, 210, 64, .18); }
.tp-stage span { display: block; margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.tp-stage.done span, .tp-stage.active span { color: #3dab28; font-weight: 600; }

/* 成功结果 */
.tp-result-title {
  margin: 4px 0 12px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: var(--ok);
}

.tp-countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #b45309;
}
.tp-countdown strong { font-variant-numeric: tabular-nums; color: #d97706; }
.tp-countdown .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #d97706;
  animation: dot-pulse 1.2s infinite ease-in-out;
}
@keyframes dot-pulse {
  0%, 100% { opacity: .4; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

.tp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.tp-row .k {
  width: 56px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-weak);
}

.tp-link {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
  color: #2563eb;
  background: #f8fbff;
  border: 1px solid #dbeafe;
  border-radius: 6px;
}
.tp-link:hover { text-decoration: underline; }

.tp-pwd {
  padding: 4px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--ok);
  background: #fff;
  border: 1px solid #d1fae5;
  border-radius: 6px;
}

.tp-mini {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  background: var(--bg-btn);
  color: #2356dc;
}
.tp-mini:hover { background: #dce7ff; }

.tp-copy-all {
  width: 100%;
  margin-top: 6px;
  padding: 10px 0;
  font-size: 13px;
  border-radius: 10px;
  background: var(--bg-btn);
  color: #2356dc;
}
.tp-copy-all:hover { background: linear-gradient(135deg, var(--bg-btn-h1), var(--bg-btn-h2)); color: #fff; }

.tp-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.tp-qr-box {
  width: 150px; height: 150px;
  display: grid;
  place-items: center;
  border: 1px solid #eef1f6;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}
.tp-qr-img {
  width: 100%; height: 100%;
  display: block;
  border-radius: 6px;
  image-rendering: pixelated;
}
.tp-qr-hint { font-size: 12px; color: var(--text-muted); }

.tp-warn {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 10px;
}

.tp-warn div { text-wrap: pretty; }

.tp-error {
  padding: 10px 0;
  text-align: center;
  font-size: 14px;
  color: #b91c1c;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 300;
  padding: 10px 20px;
  font-size: 13px;
  color: #fff;
  background: rgba(31, 41, 55, .92);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */
.footbar {
  flex-shrink: 0;
  padding: 24px var(--gutter) calc(24px + env(safe-area-inset-bottom));
  font-size: 13px;
  text-align: center;
  color: #888;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

/* 大屏首页：首屏内容垂直居中，避免标语区全挤在顶部（段落比视口高时自动回到正常流） */
@media (min-width: 721px) and (min-height: 640px) {
  body.page-home main.home {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* 大屏：内容区再宽一点，结果列表更好读 */
@media (min-width: 1440px) {
  :root { --container: 1000px; }
}

@media (max-width: 720px) {
  :root { --gutter: 14px; }

  .brand { height: clamp(150px, 24vh, 210px); margin-bottom: 18px; }
  .brand.shrink, body.page-searching .brand { height: 58px; margin-bottom: 14px; }
  .brand-logo { display: inline-block; width: 132px; transition: width .35s ease; }
  .brand.shrink .brand-logo, body.page-searching .brand-logo { width: 42px; }
  .brand-slogan, .brand-subtitle { display: none; }

  body.page-result .brand { height: auto; margin: 0; }
  body.page-result .brand .brand-logo { width: 40px; }
  body.page-result .topbar { gap: 10px; padding: 8px var(--gutter); }

  .search-form { min-height: 48px; }
  .search-input { padding: 9px 12px; }
  .search-btn { width: 46px; }

  .result-main { padding-top: 14px; }

  /* 结果项：状态徽标与信息行同排，不再绝对定位压住文字 */
  .link-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0 10px;
    margin-top: 8px;
    padding: 14px;
  }
  .link-type { display: none; }
  .link-actions { display: none; }
  .link-body { grid-column: 1; min-width: 0; }
  .link-state { grid-column: 2; grid-row: 1; align-self: end; margin-bottom: 2px; }
  .link-note { font-size: 15px; }
  .link-tags { margin-top: 7px; gap: 5px; }
  .link-tag { padding: 5px 6px; }
  .link-meta { margin-top: 9px; font-size: 12px; gap: 8px; }

  .state { border-radius: 999px; padding: 3px 9px; }

  .transfer-modal { padding: 0; align-items: flex-end; padding-bottom: env(safe-area-inset-bottom); }
  .transfer-modal-box {
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    animation: sheet-up .25s var(--ease-pop);
  }
  .transfer-body { padding: 6px 20px 22px; }
  @keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}