/* ============================================================
   Video Portfolio — Vercel Design System
   Geist Sans / shadow-as-border / 三层阴影卡片 / 消极字距
   ============================================================ */
:root {
  --geist-black: #171717;
  --geist-white: #ffffff;
  --gray-900: #171717;
  --gray-600: #4d4d4d;
  --gray-500: #666666;
  --gray-400: #808080;
  --gray-100: #ebebeb;
  --gray-50: #fafafa;
  --link-blue: #0072f5;
  --focus-blue: hsla(212, 100%, 48%, 1);
  --badge-bg: #ebf5ff;
  --badge-text: #0068d6;
  --shadow-border: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;
  --shadow-ring-border: rgb(235, 235, 235) 0px 0px 0px 1px;
  --shadow-card:
    rgba(0, 0, 0, 0.08) 0px 0px 0px 1px,
    rgba(0, 0, 0, 0.04) 0px 2px 2px,
    rgba(0, 0, 0, 0.04) 0px 8px 8px -8px,
    #fafafa 0px 0px 0px 1px;
  --font-sans: 'Geist', Arial, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-feature-settings: 'liga';
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--geist-white);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
::selection { background: #171717; color: hsla(0, 0%, 95%, 1); }
:focus-visible { outline: 2px solid var(--focus-blue); outline-offset: 2px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 860px; }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(8px);
  box-shadow: var(--shadow-border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 60px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; letter-spacing: -0.32px;
  white-space: nowrap;
}
.logo-mark {
  width: 18px; height: 18px; background: var(--geist-black);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.main-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.nav-link {
  font-size: 14px; font-weight: 500; color: var(--gray-600);
  padding: 6px 12px; border-radius: 6px; white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--gray-900); background: var(--gray-50); }
.nav-link.active { color: var(--gray-900); background: var(--gray-100); }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 48px; text-align: center; }
.hero-title {
  margin: 0;
  font-size: 48px; font-weight: 600; line-height: 1.1;
  letter-spacing: -2.4px;
}
.hero-sub {
  margin: 16px auto 0; max-width: 560px;
  font-size: 20px; font-weight: 400; line-height: 1.8;
  color: var(--gray-600);
}

/* ---------- 分类 chips ---------- */
.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 0 40px;
}
.chip {
  font-size: 14px; font-weight: 500; color: var(--gray-600);
  padding: 6px 16px; border-radius: 64px;
  box-shadow: var(--shadow-border);
  transition: color .15s, background .15s;
}
.chip:hover { color: var(--gray-900); background: var(--gray-50); }
.chip.active { background: var(--geist-black); color: var(--geist-white); }

/* ---------- 页头（分类页/后台） ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; padding: 64px 0 32px;
}
.page-title {
  margin: 0; font-size: 40px; font-weight: 600;
  line-height: 1.2; letter-spacing: -2.4px;
}
.page-sub { margin: 8px 0 0; color: var(--gray-500); font-size: 16px; }
.mono-label {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500; line-height: 1;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gray-400);
  font-feature-settings: 'tnum';
}

/* ---------- 视频网格与卡片 ---------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-bottom: 96px;
}
.video-card {
  background: var(--geist-white);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .2s;
}
.video-card:hover {
  box-shadow:
    rgba(0, 0, 0, 0.12) 0px 0px 0px 1px,
    rgba(0, 0, 0, 0.06) 0px 4px 4px,
    rgba(0, 0, 0, 0.06) 0px 12px 16px -8px,
    #fafafa 0px 0px 0px 1px;
}
.card-media {
  position: relative; display: block;
  aspect-ratio: 16 / 9; overflow: hidden;
  background:
    radial-gradient(120% 120% at 20% 10%, #2a2a2a 0%, #171717 55%, #0d0d0d 100%);
  border-radius: 12px 12px 0 0;
}
.card-poster {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.video-card:hover .card-poster { transform: scale(1.04); }
.card-poster.poster-broken { display: none; }
.card-play {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.92); color: var(--geist-black);
  opacity: 0; transition: opacity .2s, transform .2s;
  padding-left: 3px;
}
.video-card:hover .card-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 10px; }
.card-title {
  margin: 0; font-size: 24px; font-weight: 600;
  line-height: 1.33; letter-spacing: -0.96px;
}
.card-title a:hover { color: var(--gray-600); }
.card-desc {
  margin: 0; font-size: 16px; line-height: 1.5;
  color: var(--gray-600);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-actions { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; }
.caption { font-size: 12px; font-weight: 400; line-height: 1.33; color: var(--gray-400); }

/* ---------- 药丸徽标 ---------- */
.pill {
  display: inline-block;
  font-size: 12px; font-weight: 500;
  color: var(--badge-text); background: var(--badge-bg);
  padding: 3px 10px; border-radius: 9999px;
  white-space: nowrap;
}
.pill-sm { font-size: 11px; padding: 2px 8px; }

/* ---------- 按钮 ---------- */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500; line-height: 1.43;
  color: var(--geist-white); background: var(--geist-black);
  padding: 8px 16px; border: 0; border-radius: 6px;
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.btn-primary:hover { background: #383838; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500; line-height: 1.43;
  color: var(--geist-black); background: var(--geist-white);
  padding: 8px 16px; border: 0; border-radius: 6px;
  box-shadow: var(--shadow-ring-border);
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--gray-50); }
.btn-block { width: 100%; justify-content: center; }
.btn-mini {
  font-family: var(--font-sans);
  font-size: 12px; font-weight: 500;
  color: var(--gray-600); background: var(--geist-white);
  padding: 4px 10px; border: 0; border-radius: 4px;
  box-shadow: var(--shadow-border);
  cursor: pointer; white-space: nowrap;
  transition: color .15s, background .15s;
}
.btn-mini:hover { color: var(--gray-900); background: var(--gray-50); }
.btn-mini.danger:hover { color: #ff5b4f; }

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center; padding: 96px 24px;
  border-radius: 12px; box-shadow: var(--shadow-border);
  margin-bottom: 96px;
}
.empty-state.tall { padding: 140px 24px; }
.empty-title { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.96px; }
.empty-desc { margin: 12px 0 0; color: var(--gray-600); }
.empty-desc a { color: var(--link-blue); text-decoration: underline; }

/* ---------- 单视频页 ---------- */
.player-page { padding: 48px 0 96px; }
.player-wrap {
  border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-card);
  background: #000;
  aspect-ratio: 16 / 9;
}
.player-wrap video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.player-info { padding-top: 24px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.player-title {
  margin: 0; font-size: 32px; font-weight: 600;
  line-height: 1.25; letter-spacing: -1.28px;
}
.player-desc { margin: 0; font-size: 18px; line-height: 1.56; color: var(--gray-600); }

/* ---------- 页脚 ---------- */
.site-footer {
  box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.08);
  padding: 32px 0; margin-top: 24px;
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; }
.footer-admin { color: var(--gray-400); }
.footer-admin:hover { color: var(--gray-600); }

/* ---------- 后台 ---------- */
.auth-card {
  max-width: 380px; margin: 96px auto 120px;
  padding: 40px 32px; border-radius: 12px;
  box-shadow: var(--shadow-card);
}
.auth-card .page-title { margin: 8px 0 24px; font-size: 32px; letter-spacing: -1.28px; }
.form-error { color: #ff5b4f; font-size: 14px; margin: 0 0 16px; }

.admin-layout {
  display: grid; grid-template-columns: 5fr 3fr;
  gap: 24px; align-items: start; margin-bottom: 24px;
}
.panel {
  background: var(--geist-white);
  border-radius: 12px; padding: 24px;
  box-shadow: var(--shadow-card);
}
.panel-title {
  margin: 0 0 20px; font-size: 24px; font-weight: 600;
  letter-spacing: -0.96px;
}
.notice {
  padding: 16px; border-radius: 8px; margin-bottom: 24px;
  background: var(--gray-50);
  box-shadow: var(--shadow-border);
  font-size: 14px; color: var(--gray-600);
}
.notice code { font-family: var(--font-mono); font-size: 12px; background: var(--gray-100); padding: 1px 6px; border-radius: 4px; color: var(--gray-900); }
.notice.success { background: #ebf5ff; color: #0068d6; }
.notice a { color: var(--link-blue); text-decoration: underline; }

.btn-row { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check-field { display: flex; align-items: center; gap: 8px; }
.check-field input { width: auto; accent-color: var(--geist-black); }
.check-field span { font-size: 14px; color: var(--gray-600); }
.btn-row + .caption, .panel .caption { display: block; margin-top: 12px; }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field input[type="text"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%; font-family: var(--font-sans);
  font-size: 14px; color: var(--gray-900);
  background: var(--geist-white);
  padding: 8px 12px; border: 0; border-radius: 6px;
  box-shadow: var(--shadow-border);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--focus-blue); outline-offset: -1px;
}
.field textarea { resize: vertical; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; min-width: 0; margin-bottom: 0; }
.field-row select { flex: 1; min-width: 0; }
.field input[type="file"] { font-size: 13px; color: var(--gray-600); }

.progress-wrap { margin: 8px 0 16px; }
.progress-bar {
  height: 6px; border-radius: 9999px;
  background: var(--gray-100); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: var(--geist-black);
  border-radius: 9999px;
  transition: width .2s;
}
#upload-msg { margin: 8px 0 0; }

.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  box-shadow: 0px 1px 0px 0px var(--gray-100);
}
.cat-item:last-child { box-shadow: none; }
.cat-name { font-size: 14px; font-weight: 500; }
.cat-actions { display: flex; gap: 6px; }

.admin-table { display: flex; flex-direction: column; }
.admin-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0;
  box-shadow: 0px 1px 0px 0px var(--gray-100);
}
.admin-row:last-child { box-shadow: none; }
.row-thumb {
  position: relative; flex: 0 0 128px;
  aspect-ratio: 16/9; border-radius: 6px; overflow: hidden;
  background:
    radial-gradient(120% 120% at 20% 10%, #2a2a2a 0%, #171717 55%, #0d0d0d 100%);
  display: flex; align-items: center; justify-content: center;
}
.row-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.row-play { color: rgba(255,255,255,.9); font-size: 12px; position: relative; z-index: 1; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 16px; font-weight: 600; letter-spacing: -0.32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- 设置页：分组标签页（Geist Segmented Tabs） ---------- */
.settings-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  margin-bottom: 24px;
  background: var(--gray-50);
  border-radius: 10px;
  box-shadow: var(--shadow-ring-border);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tab {
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500; line-height: 1.43;
  color: var(--gray-500);
  background: transparent; border: 0;
  padding: 6px 16px; border-radius: 7px;
  cursor: pointer; white-space: nowrap;
  transition: color .15s, background .15s, box-shadow .15s;
}
.settings-tab:hover { color: var(--gray-900); background: rgba(0, 0, 0, 0.03); }
.settings-tab[aria-selected="true"] {
  color: var(--gray-900);
  font-weight: 600;
  background: var(--geist-white);
  box-shadow: var(--shadow-border), rgba(0, 0, 0, 0.04) 0px 2px 2px;
}
.settings-tab:focus-visible { outline: 2px solid var(--focus-blue); outline-offset: 2px; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: tab-in .18s ease; }
@keyframes tab-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tab-panel.is-active { animation: none; }
}

.panel-head {
  padding-bottom: 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 0 0 var(--gray-100);
}
.panel-head .mono-label { display: block; margin-bottom: 8px; }
.panel-head .panel-title { margin: 0; }
.panel-desc {
  margin: 8px 0 0;
  font-size: 14px; line-height: 1.5;
  color: var(--gray-500);
}

.panel-actions {
  display: flex; align-items: center;
  gap: 12px; flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  box-shadow: 0 -1px 0 0 var(--gray-100);
}
.panel-actions .caption { margin: 0; }

.check-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 4px;
}
.check-field {
  padding: 8px 0;
}
.check-field + .check-field { box-shadow: 0 -1px 0 0 var(--gray-100); }

.input-unit { position: relative; display: block; }
.input-unit input { padding-right: 44px !important; }
.input-unit .unit {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--gray-400);
  pointer-events: none;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translate(-50%, 16px);
  background: var(--geist-black); color: var(--geist-white);
  font-size: 14px; font-weight: 500;
  padding: 10px 20px; border-radius: 8px;
  box-shadow: rgba(0,0,0,.2) 0px 8px 24px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-layout { grid-template-columns: 1fr; }
  .hero { padding: 64px 0 40px; }
}
@media (max-width: 640px) {
  .video-grid { grid-template-columns: 1fr; }
  .hero { padding: 48px 0 32px; }
  .hero-title { font-size: 36px; letter-spacing: -1.8px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 32px; letter-spacing: -1.28px; }
  .admin-row { flex-wrap: wrap; }
  .row-actions { width: 100%; justify-content: flex-start; }
  .section-spacing, .video-grid { padding-bottom: 48px; }
  .settings-tabs { width: 100%; }
  .field-row { flex-direction: column; gap: 0; }
  .field-row > .field { margin-bottom: 16px; }
  .panel { padding: 20px 16px; }
  .panel-actions { flex-direction: column; align-items: stretch; }
  .panel-actions .btn-primary,
  .panel-actions .btn-ghost { justify-content: center; }
}
