:root {
  --bg: #0a0b0d;
  --bg-soft: #101216;
  --card: #14171c;
  --card-hover: #191d24;
  --line: #23272f;
  --text: #e7e9ee;
  --text-dim: #9aa1ae;
  --text-faint: #6b7280;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, .12);
  --danger: #ff5d6c;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; display: flex; flex-direction: column; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  background: rgba(10, 11, 13, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .3px;
  flex: none;
}
.brand-mark { color: var(--accent); font-size: 15px; transform: translateY(-1px); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 11px;
  color: var(--text-faint);
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--accent); color: var(--text-dim); }
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 190px;
  color: var(--text);
}
.search input::placeholder { color: var(--text-faint); }

select {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  outline: 0;
  cursor: pointer;
}

.btn {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 8px 15px;
  font-weight: 600;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--card-hover); border-color: #2e343f; }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: #6d99ff; }
.btn.ghost { color: var(--text-dim); }

/* ---------- main ---------- */
main { width: 100%; max-width: 1360px; margin: 0 auto; padding: 24px 28px 40px; flex: 1; }

.meta { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.stats { color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.hint { color: var(--text-faint); font-size: 12px; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { background: var(--card-hover); border-color: #2e343f; transform: translateY(-2px); box-shadow: var(--shadow); }

.thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #0e1013;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
}
.thumb img, .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb video { pointer-events: none; }
.thumb .icon {
  font-size: 34px;
  color: var(--text-faint);
  user-select: none;
}
.badge {
  position: absolute;
  top: 9px;
  left: 9px;
  background: rgba(8, 9, 11, .72);
  backdrop-filter: blur(6px);
  color: var(--text-dim);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .06);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.info { padding: 12px 13px 4px; }
.name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sub { color: var(--text-faint); font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; }

.ops { display: flex; gap: 7px; padding: 10px 13px 13px; }
.iconbtn {
  flex: 1;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  border-radius: 8px;
  padding: 5px 0;
  font-size: 12px;
  transition: background .15s, color .15s, border-color .15s;
}
.iconbtn:hover { background: var(--accent-soft); color: var(--accent); border-color: rgba(91, 140, 255, .4); }
.iconbtn.danger:hover { background: rgba(255, 93, 108, .1); color: var(--danger); border-color: rgba(255, 93, 108, .35); }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 90px 0; color: var(--text-faint); }
.empty-icon { font-size: 44px; opacity: .5; margin-bottom: 8px; }
.empty-title { font-size: 16px; color: var(--text-dim); margin: 0 0 4px; }
.empty-sub { font-size: 13px; margin: 0; }

/* ---------- footer ---------- */
.footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  padding: 18px 0 26px;
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .78); backdrop-filter: blur(6px); }
.modal-panel {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: min(1100px, 92vw);
  max-height: 90vh;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: min(420px, 92vw);
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}
.modal-close:hover { background: rgba(255, 255, 255, .15); }
.modal-content { overflow: auto; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.modal-content img, .modal-content video { max-width: 100%; max-height: 74vh; border-radius: 10px; display: block; }
.modal-caption { color: var(--text-dim); font-size: 13px; padding: 12px 6px 2px; word-break: break-all; }

/* ---------- upload ---------- */
.upload-panel { width: min(560px, 92vw); }
.upload-title { margin: 4px 0 2px; font-size: 18px; }
.upload-sub { color: var(--text-faint); font-size: 12.5px; margin: 0 0 14px; }
.drop-zone {
  border: 1.5px dashed #2e343f;
  border-radius: 12px;
  padding: 30px 20px;
  text-align: center;
  color: var(--text-dim);
  transition: border-color .15s, background .15s;
}
.drop-zone.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { font-size: 30px; color: var(--text-faint); margin-bottom: 6px; }
.linklike { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }

.upload-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 34vh; overflow: auto; }
.upl-item { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.upl-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upl-bar { height: 4px; background: #23272f; border-radius: 99px; margin-top: 7px; overflow: hidden; }
.upl-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s; }
.upl-status { font-size: 11.5px; color: var(--text-faint); margin-top: 5px; }
.upl-status.ok { color: #34d399; }
.upl-status.err { color: var(--danger); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 200;
  background: #1d222b;
  border: 1px solid #2e343f;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease-out;
}
.toast.err { border-color: rgba(255, 93, 108, .5); color: #ffb3ba; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 720px) {
  .topbar { padding: 12px 14px; gap: 12px; }
  .brand-text { display: none; }
  .search input { width: 120px; }
  main { padding: 16px 14px 30px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .hint { display: none; }
  .info { padding: 9px 10px 2px; }
  .ops { padding: 8px 10px 10px; gap: 5px; }
}
