:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #242a35;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #a8d8b9;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(15, 17, 21, .9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--accent);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .5px;
  text-decoration: none;
}

#q {
  flex: 1;
  max-width: 340px;
  padding: 7px 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
#q:focus { border-color: var(--accent); }

.count { color: var(--muted); font-size: 13px; margin-left: auto; }

.logout {
  padding: 5px 12px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  white-space: nowrap;
}
.logout:hover { color: var(--accent); border-color: var(--accent); }

main { padding: 20px; }

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

.card {
  display: block;
  color: inherit;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  transition: transform .12s ease, border-color .12s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }

.thumb { position: relative; aspect-ratio: 16 / 9; background: #0b0d11; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  font-size: 12px;
  background: rgba(0, 0, 0, .72);
  border-radius: 4px;
}

.meta { padding: 10px 12px 12px; }
.title {
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sub { margin-top: 4px; color: var(--muted); font-size: 12px; }

.empty { color: var(--muted); text-align: center; padding: 60px 20px; }
.empty code {
  padding: 2px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 13px;
}

/* 播放遮罩 */
.player {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  display: flex;
  flex-direction: column;
}

.player-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.back {
  padding: 6px 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
}
.back:hover { border-color: var(--accent); color: var(--accent); }

.player-title { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#vid {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #000;
  outline: none;
}

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  width: 300px;
  padding: 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
.login-box h1 { margin: 0 0 20px; color: var(--accent); font-size: 20px; letter-spacing: 1px; }
.login-box input {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
.login-box input:focus { border-color: var(--accent); }
.login-box button {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  color: #0f1115;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.login-box .err { margin-top: 12px; color: #f8a5a5; font-size: 13px; }

@media (max-width: 560px) {
  main { padding: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .count { display: none; }
}
