:root {
  --bg: #0b1020;
  --bg-soft: #121a33;
  --panel: #161f3d;
  --panel-2: #1c2749;
  --border: #26315a;
  --text: #e8ecf7;
  --text-dim: #9aa7c7;
  --primary: #4f7cff;
  --primary-2: #6f9bff;
  --accent: #21d4a8;
  --danger: #ff5c6c;
  --warn: #ffb547;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: radial-gradient(1200px 600px at 50% -200px, #1b2a58 0%, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-2); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); cursor: pointer;
  transition: .18s; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: #24315c; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(255,92,108,.14); border-color: rgba(255,92,108,.4); color: #ff9aa5; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
  outline: none; transition: .18s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,124,255,.18); }
.label { display: block; font-size: 13px; color: var(--text-dim); margin: 12px 0 6px; }
.hint { font-size: 12px; color: var(--text-dim); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5,8,18,.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px;
  animation: fadeIn .18s ease;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.55); animation: popIn .22s cubic-bezier(.2,.9,.3,1.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 8px; }
.modal-title { font-size: 17px; font-weight: 600; }
.modal-body { padding: 8px 20px 4px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px 20px; }
.icon-btn { background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 提示条 ---------- */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 999px; background: rgba(22,31,61,.96);
  border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 14px;
  animation: popIn .2s ease; max-width: 90vw;
}
.toast.ok { border-color: rgba(33,212,168,.5); }
.toast.err { border-color: rgba(255,92,108,.55); }

/* ---------- 上传进度弹窗 ---------- */
.upload-modal { text-align: center; }
.upload-icon { font-size: 40px; margin-bottom: 6px; }
.progress-wrap { margin: 18px 0 8px; }
.progress-bar { height: 10px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; border: 1px solid var(--border); }
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .18s ease; border-radius: 999px;
}
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.file-list-mini { margin-top: 14px; max-height: 170px; overflow-y: auto; text-align: left; }
.file-list-mini .item { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 6px 2px; border-bottom: 1px dashed var(--border); }
.file-list-mini .item:last-child { border-bottom: none; }
.file-list-mini .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list-mini .state { color: var(--text-dim); flex-shrink: 0; }
.file-list-mini .state.done { color: var(--accent); }
.file-list-mini .state.fail { color: var(--danger); }

/* ---------- 头部 / 布局 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 900;
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px; background: rgba(11,16,32,.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.logo .dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.spacer { flex: 1; }

.container { max-width: 980px; margin: 0 auto; padding: 18px 16px 90px; }

/* ---------- 分类侧栏 ---------- */
.layout { display: grid; grid-template-columns: 200px 1fr; gap: 18px; }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } }

.side { display: flex; flex-direction: column; gap: 4px; }
.side .item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  cursor: pointer; color: var(--text-dim); transition: .16s; border: 1px solid transparent;
}
.side .item:hover { background: var(--panel); color: var(--text); }
.side .item.active { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.side .item .count { margin-left: auto; font-size: 12px; color: var(--text-dim); }
@media (max-width: 760px) {
  .side { flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
  .side .item { flex-shrink: 0; }
  .side .item .count { display: none; }
}

/* ---------- 文件列表 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-box { flex: 1; min-width: 160px; }

.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.breadcrumb span.crumb { cursor: pointer; padding: 3px 8px; border-radius: 7px; }
.breadcrumb span.crumb:hover { background: var(--panel-2); color: var(--text); }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.file-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 12px; cursor: pointer; transition: .18s; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.file-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.file-card.selected { border-color: var(--accent); background: rgba(33,212,168,.08); }
.file-card .thumb {
  width: 100%; height: 84px; border-radius: 9px; overflow: hidden; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.file-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-card .fname { font-size: 13px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fmeta { font-size: 11px; color: var(--text-dim); }
.file-card .check {
  position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--bg-soft); display: none;
  align-items: center; justify-content: center; font-size: 12px; color: #fff;
}
.file-card.selectable .check { display: flex; }
.file-card.selected .check { background: var(--accent); border-color: var(--accent); }

/* 列表模式 */
.file-list-mode { display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: .16s;
}
.file-row:hover { border-color: var(--primary); }
.file-row.selected { border-color: var(--accent); background: rgba(33,212,168,.08); }
.file-row .ico { font-size: 20px; width: 26px; text-align: center; }
.file-row .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fmeta { font-size: 12px; color: var(--text-dim); flex-shrink: 0; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty .big { font-size: 52px; margin-bottom: 10px; }

/* 选择操作条 */
.action-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 950;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: rgba(22,31,61,.97); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow); animation: popIn .2s ease; max-width: calc(100vw - 24px); overflow-x: auto;
}

/* ---------- 上传拖拽 ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--text-dim); transition: .18s; cursor: pointer; margin-bottom: 14px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); color: var(--text); background: rgba(79,124,255,.06); }

/* ---------- 广告 ---------- */
.ad-banner {
  display: block; padding: 12px 16px; margin-bottom: 14px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(79,124,255,.14), rgba(33,212,168,.12));
  border: 1px solid var(--border); color: var(--text); font-size: 14px;
}
.ad-banner img { max-width: 100%; border-radius: 8px; display: block; margin-top: 8px; }
.ad-tag { font-size: 10px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; margin-right: 6px; vertical-align: middle; }

/* ---------- 预览器 ---------- */
.viewer-mask { position: fixed; inset: 0; background: rgba(3,5,12,.94); z-index: 2500; display: flex; flex-direction: column; }
.viewer-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.viewer-head .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 12px; }
.viewer-body img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.viewer-body video { max-width: 100%; max-height: 82vh; border-radius: 8px; background: #000; }
.viewer-body audio { width: min(560px, 92vw); }
.viewer-body iframe { width: 100%; height: 100%; border: none; border-radius: 8px; background: #fff; }
.viewer-body pre {
  width: min(900px, 96vw); max-height: 100%; overflow: auto; background: var(--bg-soft);
  padding: 14px; border-radius: 10px; font-size: 13px; white-space: pre-wrap; word-break: break-word;
}

/* ---------- 首页 / 登录 ---------- */
.hero { text-align: center; padding: 40px 18px 20px; }
.hero h1 { font-size: 30px; margin: 14px 0 8px; }
.hero p { color: var(--text-dim); max-width: 520px; margin: 0 auto 22px; line-height: 1.7; }
.hero .badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-dim); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 26px 0; }
.feature { padding: 18px; text-align: left; }
.feature .fi { font-size: 26px; margin-bottom: 8px; }
.feature h3 { margin: 0 0 6px; font-size: 15px; }
.feature p { margin: 0; font-size: 13px; color: var(--text-dim); line-height: 1.6; }

.auth-tabs { display: flex; gap: 6px; background: var(--bg-soft); padding: 4px; border-radius: 12px; margin-bottom: 6px; }
.auth-tabs .tab { flex: 1; text-align: center; padding: 9px; border-radius: 9px; cursor: pointer; color: var(--text-dim); transition: .16s; }
.auth-tabs .tab.active { background: var(--panel-2); color: var(--text); }

/* ---------- 表格 / 后台 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-dim); font-weight: 500; font-size: 12.5px; }
.table tr:hover td { background: rgba(79,124,255,.05); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; border: 1px solid var(--border); }
.tag.admin { color: var(--accent); border-color: rgba(33,212,168,.45); }
.tag.banned { color: var(--danger); border-color: rgba(255,92,108,.45); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 15px; }
.stat .k { font-size: 12px; color: var(--text-dim); }
.stat .v { font-size: 21px; font-weight: 700; margin-top: 5px; }

.quota-bar { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 8px; }
.quota-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs .tab { padding: 10px 14px; cursor: pointer; color: var(--text-dim); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs .tab.active { color: var(--text); border-bottom-color: var(--primary); }

.switch { position: relative; display: inline-block; width: 44px; height: 25px; flex-shrink: 0; }
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 999px; transition: .2s; cursor: pointer;
}
.switch .slider:before {
  content: ""; position: absolute; width: 19px; height: 19px; left: 2px; top: 2px;
  background: var(--text-dim); border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: rgba(33,212,168,.25); border-color: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(19px); background: var(--accent); }

.loading-spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border);
  border-top-color: var(--primary); animation: spin .8s linear infinite; margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer { text-align: center; padding: 24px 16px; color: var(--text-dim); font-size: 12.5px; }
code.token { background: var(--bg-soft); padding: 2px 7px; border-radius: 6px; font-family: ui-monospace, monospace; font-size: 12.5px; }
