/* freewink-video —— 全站样式。只此一个文件，不引任何 UI 框架。
   设计约束：深色底、大留白、窄屏（≤760px）绝不出现横向滚动。 */

:root {
  --bg: #0b1020;
  --bg-soft: #101728;
  --panel: #141c31;
  --panel-2: #1a2340;
  --line: #24304f;
  --text: #e9edf8;
  --muted: #8d99b8;
  --brand: #4f8cff;
  --brand-dark: #2f6ae0;
  --gold: #ffc857;
  --danger: #ff5c72;
  --ok: #35d07f;
  --warn: #ffa63d;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 600px at 50% -200px, #16203a 0%, var(--bg) 60%);
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans SC", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.3; font-weight: 650; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0 0 1em; }

.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.err { color: var(--danger); }

/* ---------- 顶栏 / 页脚 ---------- */
.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 32, .82);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), #7c5cff);
  display: grid; place-items: center;
  font-size: 13px; color: #fff;
}
.site-nav { display: flex; gap: 18px; align-items: center; font-size: 14px; color: var(--muted); }
.site-nav a:hover { color: var(--text); }
.nav-admin {
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 999px;
}
.site-foot {
  margin-top: auto;
  padding: 28px 24px 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- 容器 ---------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 26px 24px 40px; }
.wrap-narrow { max-width: 900px; }
.hero { margin-bottom: 22px; }
.hero-admin { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.search { margin-top: 14px; max-width: 380px; }
.search input {
  width: 100%; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 14px;
}
.search input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---------- 视频卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 18px; }
.grid-sm { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
  display: block;
}
.card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); color: inherit; }

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #080c17;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { font-size: 30px; color: #33406a; }
.badge-dur {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0, 0, 0, .78); color: #fff;
  font-size: 12px; padding: 2px 7px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.card-body { padding: 12px 14px 14px; }
.card-title {
  font-size: 15px; margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* 英文比中文长：容器允许换行，但每一项内部不许断（否则会出现「Sep 29, / 2026」这种拆行） */
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.card-meta > span { white-space: nowrap; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 70px 20px; }
/* 目录骨架始终显示，空库提示就压缩一点，别把产品线挤到屏幕外 */
.empty.slim { padding: 26px 20px 34px; }
.empty.slim .empty-icon { font-size: 32px; }
.empty.slim h2 { font-size: 17px; }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty-hint { color: var(--muted); padding: 30px 0; }

/* ---------- 播放页 ---------- */
.player-shell {
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.player { width: 100%; height: 100%; display: block; background: #000; }
.player-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 14px; pointer-events: none;
}
.watch-title { margin-top: 20px; font-size: 22px; }
.watch-meta { display: flex; gap: 7px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.watch-desc {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 16px;
  white-space: normal; word-break: break-word;
}
.watch-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.related { margin-top: 34px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid transparent; background: var(--panel-2); color: var(--text);
  font-size: 14px; font-family: inherit; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s;
  /* 按钮文字绝不允许折行：后台表格里「复制」「删除」曾被挤成两行（截图验证时发现） */
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: linear-gradient(140deg, var(--brand), var(--brand-dark)); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: transparent; border-color: #6b2436; color: var(--danger); }
.btn.danger:hover { background: #2a1420; }
.btn.sm { padding: 6px 13px; font-size: 13px; }
.btn.xs { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 登录 ---------- */
.login-card {
  max-width: 380px; margin: 40px auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px;
  box-shadow: var(--shadow);
}
.field { display: block; margin: 16px 0 20px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); font-size: 15px;
}
.field input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---------- 提示条 ---------- */
.alert {
  background: #2a1620; border: 1px solid #6b2436; color: #ffb3c0;
  padding: 10px 14px; border-radius: var(--radius-sm); margin: 14px 0; font-size: 13.5px;
}

/* ---------- 后台 ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 22px;
}
.disk { margin-bottom: 22px; }
.disk-bar { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.disk-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #7c5cff); }
.disk-warn .disk-bar span { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.disk-text { margin-top: 7px; font-size: 13px; color: var(--muted); }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 30px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: rgba(79, 140, 255, .07); }
.drop-icon { font-size: 28px; margin-bottom: 8px; color: var(--brand); }

.upload-state { margin-top: 18px; }
.up-line { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; gap: 12px; }
.up-line span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-detail { margin-top: 8px; font-size: 12.5px; }
.up-actions { margin-top: 12px; }

.progress { height: 7px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #7c5cff); transition: width .3s ease; }
.progress-sm { height: 5px; margin-top: 6px; max-width: 130px; }

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 1040px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted);
  padding: 0 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid rgba(36, 48, 79, .55); vertical-align: middle; }
.table td.nowrap { white-space: nowrap; }

.row-video { display: flex; gap: 12px; align-items: center; min-width: 260px; }
.row-thumb {
  width: 74px; height: 44px; flex: 0 0 74px; border-radius: 7px; overflow: hidden;
  background: #080c17; display: grid; place-items: center; color: #33406a;
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-main { min-width: 0; flex: 1; }
.row-title {
  width: 100%; background: transparent; border: 1px solid transparent; border-radius: 7px;
  color: var(--text); font: inherit; font-size: 14.5px; padding: 4px 6px;
}
.row-title:hover { border-color: var(--line); }
.row-title:focus { outline: none; border-color: var(--brand); background: var(--bg-soft); }
.row-sub { font-size: 12px; margin-top: 2px; }

.link-cell { display: flex; gap: 6px; align-items: center; }
.row-link {
  width: 108px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 7px;
  color: var(--muted); font-size: 12.5px; padding: 4px 7px;
}
.ops { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-width: 300px; }
.switch { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--brand); }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; background: var(--panel-2); color: var(--muted); white-space: nowrap;
}
.pill-ready { background: rgba(53, 208, 127, .14); color: var(--ok); }
.pill-transcoding, .pill-queued { background: rgba(79, 140, 255, .14); color: var(--brand); }
.pill-failed { background: rgba(255, 92, 114, .14); color: var(--danger); }
.pill-uploading { background: rgba(255, 200, 87, .14); color: var(--gold); }

/* ---------- 产品目录（分类 → 型号） ---------- */
.cat-tabs {
  display: flex; flex-wrap: wrap; gap: 9px;
  margin: 18px 0 26px;
}
.cat-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 14px; color: var(--text); white-space: nowrap;
}
.cat-tab:hover { border-color: var(--brand); color: var(--text); }
.cat-tab.active {
  background: linear-gradient(140deg, var(--brand), var(--brand-dark));
  border-color: transparent; color: #fff;
}
.cnt {
  font-size: 12px; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .09); color: inherit;
  padding: 1px 7px; border-radius: 999px; opacity: .85;
}
.cat-tab.active .cnt { background: rgba(255, 255, 255, .22); }

.cat-block { margin-bottom: 40px; }
.cat-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; margin-bottom: 18px;
  padding-left: 12px; border-left: 3px solid var(--brand);
}
.cat-title a:hover { color: var(--brand); }

.model-block { margin: 0 0 26px 3px; }
.model-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 600; color: #c7d2ea;
  margin-bottom: 12px;
}
.model-title::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); display: inline-block;
}
/* 还没视频的型号：保留在目录里让人看到完整产品线，但明显压暗 */
.model-block.is-empty { opacity: .5; }
.model-empty {
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: 16px; font-size: 13px; margin: 0;
  max-width: 340px; /* 占满整行会显得像版面出错 */
}

.badge-model {
  display: inline-block; padding: 1px 8px; border-radius: 6px;
  background: rgba(255, 200, 87, .13); color: var(--gold);
  font-size: 12px; white-space: nowrap;
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted); margin-bottom: 8px;
}
.crumb-sep { color: #3a4666; }
.crumb-here { color: var(--text); }

/* ---------- 后台：上传前选目录 / 列表里改目录 ---------- */
.pick-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin: 4px 0 18px;
}
.pick-row .field { margin: 0; }
.field select {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  font-size: 15px; font-family: inherit;
}
.field select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.cat-cell { display: flex; flex-direction: column; gap: 6px; min-width: 132px; }
.row-select {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); font: inherit; font-size: 13px; padding: 4px 6px; width: 100%;
}
.row-select:focus { outline: none; border-color: var(--brand); }

.inventory { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }.inv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inv-cat {
  min-width: 74px; font-size: 14px; font-weight: 600; color: #c7d2ea;
}
.inv-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 999px;
  background: var(--panel-2); font-size: 13px;
}
.inv-item b { color: var(--brand); font-variant-numeric: tabular-nums; }
.inv-empty { color: var(--muted); }
.inv-empty b { color: var(--muted); }

/* 未完成的上传：让用户看见服务器上还躺着半截文件，可以续传或放弃 */
.pending-list { display: flex; flex-direction: column; gap: 12px; }
.pending-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.pending-main { flex: 1; min-width: 0; }
.pending-name {
  font-size: 14.5px; margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pending-sub { font-size: 12.5px; margin-bottom: 7px; }
.pending-pct {
  font-size: 15px; font-weight: 600; color: var(--brand);
  font-variant-numeric: tabular-nums; min-width: 46px; text-align: right;
}

/* ---------- 窄屏：不许横向滚动 ---------- */
@media (max-width: 760px) {
  .wrap { padding: 18px 14px 30px; }
  .site-head { padding: 12px 14px; }
  h1 { font-size: 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .grid-sm { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .card-title { font-size: 14px; }
  .watch-title { font-size: 19px; }
  .panel { padding: 16px 14px; }
  .login-card { margin: 20px auto; padding: 20px; }
  .cat-title { font-size: 18px; }
  .pick-row { grid-template-columns: 1fr; gap: 12px; }
  .site-nav { gap: 12px; font-size: 13px; }
}
