/* Archive · 视频搜索 —— 瀑布流 / 详细信息 / 矩阵 + ArtPlayer
   强调色：#137d69（深青） / #e0eee9（浅青白）
   全站圆角 3px */

:root {
  --bg: #05070a;
  --panel: #0f1318;      /* 输入框 / 按钮 */
  --surface: #0c1015;    /* 卡片 / 瓦片 */
  --frame: #000;         /* 黑框 */
  --line: rgba(255, 255, 255, .07);
  --txt: #e9eef5;
  --txt-2: #8f9aa8;
  --txt-3: #636e7c;
  --acc: #137d69;
  --acc-ink: #e0eee9;
  --r: 5px;
  --font: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  background:
    radial-gradient(900px 520px at 80% -10%, rgba(19, 125, 105, .07), transparent 60%),
    var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { display: block; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #232a33; border-radius: var(--r); border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #313b47; background-clip: content-box; }

/* ── 顶栏 ─────────────────────────────────────────── */
.bar {
  flex: none;
  display: flex; align-items: center; gap: 18px;
  min-height: 58px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 15, .85);
  position: relative; z-index: 5;
}

/* 左上角：后台活动指示 */
.status {
  display: flex; align-items: center; gap: 9px; flex: none;
  cursor: default; user-select: none;
}
.conn {
  font-size: 12px; font-weight: 500; letter-spacing: .8px;
  color: #74cba7; text-transform: lowercase;
}
.conn.is-offline { color: #ef7777; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: #56d6a1;
  box-shadow: 0 0 0 3px rgba(86, 214, 161, .14);
  position: relative; flex: none;
}
.pulse::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid rgba(86, 214, 161, .6);
  animation: live 2.2s ease-out infinite;
  will-change: transform, opacity;   /* 独立合成层，别带着整页重绘 */
}
/* 连接中：琥珀色快闪 */
.pulse.is-connecting { background: #f2b544; box-shadow: 0 0 0 3px rgba(242, 181, 68, .28); }
.pulse.is-connecting::after { border-color: rgba(242, 181, 68, .8); animation-duration: .9s; }
/* 断开：灰点，停止呼吸 */
.pulse.is-offline { background: #ec6868; box-shadow: 0 0 0 3px rgba(236,104,104,.12); }
.pulse.is-offline::after { animation: none; border-color: transparent; }
@keyframes live {
  0% { transform: scale(.5); opacity: .9; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ── 搜索框 ───────────────────────────────────────── */
.search {
  position: relative; flex: 1 1 auto; max-width: 680px; margin: 0 auto;
  display: flex; align-items: center; gap: 4px;
  height: 40px; padding: 3px 3px 3px 14px; border-radius: var(--r);
  background: #05070a; border: 1px solid var(--frame);
  transition: border-color .15s, box-shadow .18s, background .15s;
}
.search:focus-within {
  border-color: var(--acc-ink);
  box-shadow: 0 0 0 2px rgba(224, 238, 233, .12);
}
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none;
  font-size: 13.5px; color: var(--txt); letter-spacing: .1px;
}
.search input::placeholder { color: #59636f; }
.search input::-webkit-search-cancel-button { display: none; }

.clr {
  display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: var(--r); color: var(--txt-3); flex: none;
}
.clr svg { width: 13px; height: 13px; }
.clr:hover { background: #1b222b; color: var(--txt); }

/* 主按钮：浅底 + 深青图标 */
.go {
  flex: none; display: grid; place-items: center;
  width: 46px; height: auto; align-self: stretch;   /* 撑满输入框内高，上下留白对称 */
  border-radius: var(--r);
  border: 0; background: transparent; color: var(--acc);
  transition: background .1s, color .1s, transform .1s;
}
.go svg { width: 17px; height: 17px; }
.go, .vb { will-change: background-color, color; }
/* hover：强调色的半透明底，图标提亮 */
.go:hover { background: rgba(19, 125, 105, .22); color: var(--acc-ink); }
.go:active { transform: scale(.98); }

.views { display: flex; gap: 2px; padding: 3px; border-radius: var(--r); background: #05070a; border: 1px solid var(--frame); flex: none; }
.vb {
  display: grid; place-items: center; width: 34px; height: 30px; border-radius: var(--r);
  color: var(--txt-3); border: 0; background: transparent;
  transition: background .1s, color .1s;
}
.vb svg { width: 17px; height: 17px; }
.vb:hover { background: rgba(19, 125, 105, .22); color: var(--acc-ink); }
.vb.on { color: var(--acc-ink); background: rgba(19, 125, 105, .3); }
.vb.on:hover { background: rgba(19, 125, 105, .4); color: var(--acc-ink); }

/* ── 网格容器 ─────────────────────────────────────── */
.main { position: relative; display: flex; flex: 1 1 auto; min-height: 0; }
.idle {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; align-items: center;   /* 左右居中 */
  justify-content: flex-start;
  padding-top: clamp(24px, calc(var(--app-height, 100dvh) * .08), 96px);
  gap: 12px;
}
.idle svg { width: 52px; height: 52px; color: #2b323b; }
.idle h3 {
  margin: 0; font-size: 14px; font-weight: 400; color: var(--txt-2); letter-spacing: .2px;
}
.grid {
  display: block; flex: 1 1 auto; min-width: 0; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 20px 40px;
}

/* ── 瀑布流 ───────────────────────────────────────── */
.results.waterfall { display: flex; align-items: flex-start; gap: 14px; }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--frame); border-radius: var(--r);
  overflow: hidden; cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .22s ease;
}
.card:hover {
  transform: translateY(-2px); background: #111820;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .62);
}

.thumb { position: relative; width: 100%; background: #0b0e12; }
.thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.card:hover .thumb img { transform: scale(1.045); }

.dur, .size {
  position: absolute; bottom: 7px; padding: 2px 6px; border-radius: var(--r);
  background: rgba(0, 0, 0, .74); font-size: 10.5px; letter-spacing: .3px;
  font-variant-numeric: tabular-nums;
}
.dur { right: 7px; color: #e7edf5; }
.size { left: 7px; color: #cfd8e3; }

.play-ico {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0;
  background: radial-gradient(circle, rgba(0, 0, 0, .3), rgba(0, 0, 0, .04));
  transition: opacity .2s;
}
.play-ico > span {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(5, 7, 10, .82); border: 1px solid var(--acc-ink); color: var(--acc-ink);
  transform: scale(.82); transition: transform .22s cubic-bezier(.2, .8, .3, 1.2);
}
.card:hover .play-ico > span { background: rgba(224, 238, 233, .14); }
.play-ico svg { width: 20px; height: 20px; }
.card:hover .play-ico { opacity: 1; }
.card:hover .play-ico > span { transform: scale(1); }

.card-body { padding: 9px 10px 11px; }
.card-title {
  margin: 0; font-size: 12.5px; line-height: 1.45; font-weight: 500; color: #dee6ef;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.card:hover .card-title { color: #fff; }

mark { background: var(--acc-ink); color: #08110e; border-radius: 2px; padding: 0 1px; }

/* ── 矩阵（与瀑布流同列宽、16:9） ─────────────────── */
.results.matrix {
  display: grid; gap: 14px; align-content: start;
  align-items: start; grid-auto-rows: auto;
}
.tile {
  position: relative; width: 100%; min-width: 0; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--frame); background: var(--surface); cursor: pointer;
  transition: background .16s, transform .16s, box-shadow .2s;
}
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .45s; }
.tile:hover {
  transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0, 0, 0, .6); z-index: 2;
}
.tile:hover img { transform: scale(1.06); }
.tile .size, .tile .dur { z-index: 3; }
.tile .ov {
  position: absolute; inset: 0; z-index: 2; padding: 10px;
  display: flex; flex-direction: column; justify-content: flex-start;
  opacity: 0; transition: opacity .2s;
  background: linear-gradient(to bottom, rgba(4, 6, 9, .92) 0%, rgba(4, 6, 9, .55) 45%, transparent 78%);
}
.tile:hover .ov, .tile:focus-visible .ov { opacity: 1; }
.tile .ov b {
  font-size: 12px; font-weight: 500; line-height: 1.4; color: #eaf1f8;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── 详细信息 ──────────────────────────────────── */
.results.list { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 84px 96px;
  align-items: center; gap: 18px; width: 100%; max-width: 1080px;
  min-height: 130px;
  padding: 8px 12px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer;
  transition: background .14s, border-color .14s;
}
.row:hover { background: var(--surface); border-color: var(--frame); }
.row-thumb {
  position: relative; width: 202px; aspect-ratio: 16 / 9;
  border-radius: var(--r); overflow: hidden; background: #0b0e12;
}
.row-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.row-thumb .dur { right: 4px; bottom: 4px; font-size: 9.5px; padding: 1px 4px; }
.row-title {
  font-size: 13px; color: #dfe7f0; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row:hover .row-title { color: #fff; }
.row-cell {
  font-size: 11.5px; color: var(--txt-2); text-align: right;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ── 加载更多 ─────────────────────────────────────── */
.more-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 0 8px; overflow-anchor: none; }
.more {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 104px; height: 34px; padding: 0 18px; border-radius: var(--r); font-size: 12.5px;
  color: var(--txt-2); background: #05070a; border: 1px solid var(--frame);
  transition: color .15s, border-color .15s, background .15s;
}
.more:hover { color: #fff; border-color: var(--frame); background: #131a22; }
.more.is-loading::before { content: ''; width: 12px; height: 12px; border: 1px solid #315449; border-top-color: #85cdb5; border-radius: 50%; animation: load-more-spin .7s linear infinite; }
.more-error { margin: 0; color: #d7ad80; font-size: 12px; }
@keyframes load-more-spin { to { transform: rotate(360deg); } }

/* ── 空结果 ───────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 110px 20px; text-align: center; color: var(--txt-3);
}
.empty svg { width: 52px; height: 52px; color: #2b323b; }
.empty h3 { margin: 6px 0 0; font-size: 14px; font-weight: 500; color: var(--txt-2); }
.empty p { margin: 0; font-size: 12px; }

/* ── 播放器弹层 ───────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 90; display: none; }
.modal.on { display: block; }
.mask {
  position: absolute; inset: 0; z-index: 0;
  background: rgba(3, 5, 8, .78); backdrop-filter: blur(10px);
}
.panel {
  position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1080px, calc(100vw - 80px), calc((100vh - 120px) * 16 / 9));
  background: #0b0f14; border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--r); overflow: hidden; box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
}
.panel-head {
  display: flex; align-items: center; gap: 14px; padding: 11px 12px 11px 18px;
  background: #0f141a; color: var(--txt); border-bottom: 1px solid var(--line);
}
.panel-head h3 {
  margin: 0; flex: 1; min-width: 0; font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel-head .close {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--r); color: var(--txt-3);
}
.panel-head .close svg { width: 17px; height: 17px; }
.panel-head .close:hover { background: rgba(255, 255, 255, .07); color: #fff; }

/* 仅设置播放器容器，内部布局使用 Artplayer 自带样式。 */
.stage { position: relative; background: #000; width: 100%; aspect-ratio: 16 / 9; max-height: 80vh; overflow: hidden; }
.stage > video { width: 100%; height: 100%; display: block; }

/* ── 平板 ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .grid { padding: 14px 16px 32px; }
}

/* ── 手机 ─────────────────────────────────────────── */
@media (max-width: 760px) {
  .bar {
    flex-wrap: wrap; gap: 10px; min-height: 0;
    padding: 9px 12px 10px;
  }
  .status { gap: 8px; }
  .search input { font-size: 16px; }
  .search { order: 3; flex: 1 1 100%; max-width: none; height: 38px; }
  .views { margin-left: auto; }
  .grid { padding: 10px 12px 28px; }
  .results.waterfall, .results.matrix { gap: 10px; }
  .col { gap: 10px; }

  .row { grid-template-columns: 112px minmax(0, 1fr); min-height: 80px; gap: 12px; padding: 6px 0; }
  .row-thumb { width: 112px; }
  .row > .row-cell { display: none; }
  .row-title { font-size: 12px; }

  .panel { width: calc(100vw - 16px); }
  .stage { max-height: 58vh; }
  .panel-head { padding: 9px 8px 9px 12px; gap: 8px; }
  .panel-head h3 { font-size: 12.5px; }
  .dur, .size { font-size: 10px; padding: 1px 5px; }
}

/* ── 窄屏 ─────────────────────────────────────────── */
@media (max-width: 420px) {
  .conn { font-size: 11px; }
  .vb { width: 30px; }
  .empty { padding: 70px 14px; }
}

.stage-error {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 10px 16px; border-radius: 5px; font-size: 12.5px;
  color: #ffb4b4; background: rgba(20, 0, 0, .72); border: 1px solid rgba(255, 120, 120, .35);
  pointer-events: none; z-index: 5;
}

/* Search progress stays separate from connection health. */
.search-progress { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 25px 12px 5px; color: var(--txt-2); font-size: 12px; }
.search-progress.is-empty { padding: 120px 16px 30px; }
.progress-caption { display: flex; align-items: center; gap: 9px; letter-spacing: .3px; }
.progress-count { margin-left: 5px; color: var(--txt-3); font-variant-numeric: tabular-nums; }
.progress-orbit { width: 6px; height: 6px; border-radius: 50%; background: #6c9588; }
.is-busy .progress-orbit { animation: progress-breathe 1.6s ease-in-out infinite; }
.progress-track { width: 140px; height: 1px; overflow: hidden; background: rgba(98,162,140,.12); }
.progress-track i { display: block; height: 100%; width: 38%; background: linear-gradient(90deg, transparent, #4aab8c, transparent); animation: progress-travel 1.8s ease-in-out infinite; }
.more:disabled { cursor: default; opacity: .45; }
.card, .row, .tile { animation: result-enter .28s ease-out backwards; }
@keyframes progress-breathe { 50% { opacity: .35; transform: scale(.75); } }
@keyframes progress-travel { from { transform: translateX(-110%); } to { transform: translateX(370%); } }
@keyframes result-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .pulse::after, .progress-orbit, .progress-track i, .card, .row, .tile, .more::before { animation: none !important; } }

@media (pointer: coarse) { .search input { font-size: 16px; } }
