/* ============================================================
   片库 CINEARCHIVE —— 暗房 / 剪辑台
   近黑底 + 琥珀橙强调 + 衬线标题 + 等宽元数据
   ============================================================ */

@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Instrument Serif';
  src: url('/fonts/instrument-serif-latin-400-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/hanken-grotesk-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/hanken-grotesk-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/hanken-grotesk-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/hanken-grotesk-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --bg: #0B0B0F;
  --bg-deep: #07070A;
  --panel: #14141A;
  --panel-hi: #1B1B23;
  --ink: #EDEAE3;
  --ink-dim: #9A968D;
  --ink-faint: #6A675F;
  --amber: #FF7A18;
  --amber-dim: #B8550F;
  --amber-glow: rgba(255, 122, 24, .28);
  --hairline: rgba(255, 255, 255, .09);
  --hairline-soft: rgba(255, 255, 255, .05);
  --danger: #E04B4B;
  --ok: #4FB477;

  --serif: 'Instrument Serif', 'Songti SC', 'Noto Serif CJK SC', Georgia, serif;
  --sans: 'Hanken Grotesk', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', 'SF Mono', 'Cascadia Mono', monospace;

  --gutter: clamp(18px, 4vw, 56px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  /* 顶部一点琥珀色辉光，模拟剪辑台顶灯 */
  background-image:
    radial-gradient(120% 70% at 50% -18%, rgba(255, 122, 24, .10), transparent 60%),
    radial-gradient(90% 60% at 88% 4%, rgba(255, 122, 24, .05), transparent 55%);
  background-attachment: fixed;
}

/* 胶片颗粒 */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: .30;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

::selection { background: var(--amber); color: #0B0B0F; }

/* ------------------------------- 顶栏 ------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top))
           calc(var(--gutter) + env(safe-area-inset-right))
           14px
           calc(var(--gutter) + env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(11,11,15,.94), rgba(11,11,15,.72) 62%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.gear {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--hairline);
  border-radius: 11px;
  color: var(--ink-dim);
  background: var(--panel);
  transition: color .3s var(--ease), border-color .3s var(--ease),
              box-shadow .3s var(--ease), transform .3s var(--ease);
}
.gear svg { width: 19px; height: 19px; }
.gear:hover {
  color: var(--amber);
  border-color: rgba(255,122,24,.45);
  box-shadow: 0 0 0 4px rgba(255,122,24,.08), 0 6px 20px rgba(0,0,0,.5);
  transform: rotate(90deg);
}
.gear:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.wordmark {
  display: flex; align-items: baseline; gap: 10px;
  text-decoration: none; color: inherit;
}
.wordmark-cn {
  font-family: var(--serif);
  font-size: 25px; letter-spacing: .10em;
  line-height: 1;
}
.wordmark-en {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: .34em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.topbar-slot { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ------------------------------- 主体 ------------------------------- */

.app {
  padding: 0 calc(var(--gutter) + env(safe-area-inset-right))
           calc(120px + env(safe-area-inset-bottom))
           calc(var(--gutter) + env(safe-area-inset-left));
  max-width: 1440px;
  margin: 0 auto;
}

.boot {
  display: flex; align-items: center; gap: 12px;
  padding: 90px 0;
  color: var(--ink-faint);
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em;
}
.boot-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .25; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.25); }
}

/* ---------------------------- 区块标题 ---------------------------- */

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 46px 0 26px;
  border-bottom: 1px solid var(--hairline-soft);
  margin-bottom: 30px;
}
.section-kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: .3em;
  color: var(--amber); text-transform: uppercase;
  margin: 0 0 10px;
}
.section-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(38px, 6.4vw, 76px);
  line-height: .98; letter-spacing: -.015em;
  margin: 0;
}
.section-title em {
  font-style: italic;
  color: var(--amber);
}
.section-note {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--ink-faint);
  margin: 0 0 6px;
}

/* ---------------------------- 合集网格 ---------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 26px;
}
/* 杂志式破格：首张卡片跨两列 */
.grid > .card:first-child { grid-column: span 2; }

.card {
  position: relative;
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: 16px;
  overflow: hidden;
  animation: rise .6s var(--ease) backwards;
  transition: transform .38s var(--ease), border-color .38s var(--ease),
              box-shadow .38s var(--ease);
}
.card:hover {
  transform: translateY(-6px);
  border-color: rgba(255,122,24,.34);
  box-shadow: 0 20px 46px -18px rgba(0,0,0,.9), 0 0 34px -14px var(--amber-glow);
}
.card:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

.card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(140deg, #23232C, #14141A 60%, #0E0E13);
  overflow: hidden;
}
.card:first-child .card-cover { aspect-ratio: 32 / 9; }
.card-cover img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
  filter: saturate(.92) contrast(1.04);
  transition: transform .7s var(--ease), filter .5s var(--ease);
}
.card:hover .card-cover img { transform: scale(1.055); filter: saturate(1.05) contrast(1.06); }

/* 无封面时的琥珀渐变占位 + 首字母 */
.card-cover.is-empty { display: grid; place-items: center; }
.card-cover.is-empty::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(80% 120% at 20% 0%, rgba(255,122,24,.30), transparent 62%),
    radial-gradient(70% 110% at 88% 100%, rgba(255,122,24,.14), transparent 60%);
}
.card-initial {
  position: relative;
  font-family: var(--serif); font-size: 76px; line-height: 1;
  color: rgba(255,122,24,.85);
  text-shadow: 0 0 44px rgba(255,122,24,.5);
  user-select: none;
}
.card-cover.is-empty::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, var(--amber), transparent);
  opacity: .55;
}

.card-index {
  position: absolute; top: 12px; left: 14px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .22em;
  color: var(--ink-dim);
  background: rgba(7,7,10,.72);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 3px 7px;
  backdrop-filter: blur(6px);
}
.card-play {
  position: absolute; right: 14px; bottom: 14px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255,122,24,.92);
  color: #0B0B0F;
  box-shadow: 0 8px 24px rgba(255,122,24,.34);
  opacity: 0; transform: translateY(8px) scale(.85);
  transition: all .35s var(--ease);
}
.card:hover .card-play { opacity: 1; transform: none; }
.card-play svg { width: 15px; height: 15px; margin-left: 2px; }

.card-body { padding: 18px 20px 20px; }
.card-title {
  font-family: var(--serif); font-weight: 400;
  font-size: 25px; line-height: 1.14; letter-spacing: -.005em;
  margin: 0 0 8px;
}
.card-meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em;
  color: var(--ink-faint);
}
.card-meta span { display: inline-flex; align-items: center; gap: 6px; }
.card-meta span + span::before {
  content: '·'; color: var(--hairline); margin-right: 6px;
}
.card-desc {
  margin: 10px 0 0;
  font-size: 13.5px; color: var(--ink-dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------ 空态 ------------------------------ */

.empty {
  border: 1px dashed var(--hairline);
  border-radius: 18px;
  padding: 78px 40px;
  text-align: center;
  background: rgba(20,20,26,.5);
}
.empty-mark {
  font-family: var(--serif); font-size: 62px; line-height: 1;
  color: var(--amber); opacity: .5; margin-bottom: 18px;
}
.empty h2 {
  font-family: var(--serif); font-weight: 400; font-size: 30px;
  margin: 0 0 10px;
}
.empty p { color: var(--ink-dim); margin: 0 0 26px; font-size: 14.5px; }

/* ------------------------------ 按钮 ------------------------------ */

.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  letter-spacing: .02em;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .25s var(--ease);
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--amber); color: #0B0B0F;
  box-shadow: 0 8px 24px -10px var(--amber-glow);
}
.btn-primary:hover:not(:disabled) {
  background: #FF8C36;
  transform: translateY(-1px);
  box-shadow: 0 12px 30px -10px rgba(255,122,24,.5);
}
.btn-ghost {
  background: transparent; color: var(--ink-dim);
  border-color: var(--hairline);
}
.btn-ghost:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-faint); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(224,75,75,.35); }
.btn-danger:hover:not(:disabled) { background: rgba(224,75,75,.12); border-color: var(--danger); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: 8px; }
.btn svg { width: 15px; height: 15px; }

/* --------------------------- 合集详情 --------------------------- */

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr);
  gap: 34px;
  padding-top: 34px;
}

.player-shell {
  background: var(--bg-deep);
  border: 1px solid var(--hairline-soft);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}
.player-shell video {
  display: block; width: 100%; aspect-ratio: 16/9;
  background: #000;
}
/* 自动播放被拦截时的「点击播放」按钮
   只做居中圆钮，不盖满整块 —— 否则会挡住原生控制条，拖进度条就没法用了 */
.tap-to-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  width: 68px; height: 68px;
  padding: 0; border: 0;
  border-radius: 50%;
  background: rgba(255, 122, 24, .92);
  color: #0B0B0F;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .55), 0 0 0 6px rgba(255, 122, 24, .14);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tap-to-play[hidden] { display: none; }
.tap-to-play svg { width: 28px; height: 28px; margin-left: 3px; }
.player-empty {
  display: grid; place-items: center;
  aspect-ratio: 16/9;
  color: var(--ink-faint);
  font-family: var(--mono); font-size: 12px; letter-spacing: .2em;
}

.detail-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.06; margin: 26px 0 8px;
}
.detail-desc { color: var(--ink-dim); margin: 0 0 18px; max-width: 62ch; font-size: 14.5px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.playlist {
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: 16px;
  padding: 8px;
  max-height: 76vh; overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline) transparent;
}
.playlist::-webkit-scrollbar { width: 7px; }
.playlist::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 4px; }

.pl-item {
  display: grid; grid-template-columns: 92px 1fr; gap: 12px;
  padding: 8px; border-radius: 11px;
  cursor: pointer; align-items: center;
  border: 1px solid transparent;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.pl-item:hover { background: var(--panel-hi); }
.pl-item.is-active {
  background: var(--panel-hi);
  border-color: rgba(255,122,24,.42);
}
.pl-thumb {
  aspect-ratio: 16/9; border-radius: 7px; overflow: hidden;
  background: linear-gradient(140deg, #23232C, #131318);
  display: grid; place-items: center;
  position: relative;
}
.pl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pl-thumb::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.42), transparent 62%);
}
.pl-title {
  font-size: 13.5px; font-weight: 500; line-height: 1.32;
  margin: 0 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pl-meta {
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  color: var(--ink-faint);
  display: flex; gap: 9px; flex-wrap: wrap;
}
.pl-empty { padding: 40px 20px; text-align: center; color: var(--ink-faint); font-size: 13.5px; }

/* --------------------------- 管理控制台 --------------------------- */

.console {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(0, 1.5fr);
  gap: 30px;
  padding-top: 34px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--hairline-soft);
  border-radius: 16px;
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.panel-title {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .26em;
  text-transform: uppercase; color: var(--amber); margin: 0;
}
.panel-body { padding: 20px; }

.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 7px;
}
.input, .textarea, .select {
  width: 100%;
  font-family: var(--sans); font-size: 14px;
  color: var(--ink);
  background: var(--bg-deep);
  border: 1px solid var(--hairline);
  border-radius: 9px;
  padding: 10px 12px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255,122,24,.12);
}
.textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.select { cursor: pointer; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.coll-list { display: flex; flex-direction: column; gap: 6px; }
.coll-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.coll-row:hover { background: var(--panel-hi); }
.coll-row.is-selected {
  background: var(--panel-hi);
  border-color: rgba(255,122,24,.42);
}
.coll-row-title { font-size: 14px; font-weight: 500; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coll-row-count { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.coll-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .2s var(--ease); }
.coll-row:hover .coll-actions, .coll-row.is-selected .coll-actions { opacity: 1; }

.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent; color: var(--ink-faint);
  cursor: pointer;
  transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--ink); background: var(--panel); border-color: var(--hairline); }
.icon-btn.is-danger:hover { color: var(--danger); border-color: rgba(224,75,75,.35); }
.icon-btn svg { width: 14px; height: 14px; }

/* 上传区 */
.dropzone {
  border: 1px dashed var(--hairline);
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .25s var(--ease);
  background: rgba(7,7,10,.35);
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--amber);
  background: rgba(255,122,24,.05);
}
.dropzone-icon { color: var(--amber); margin-bottom: 10px; }
.dropzone-icon svg { width: 30px; height: 30px; }
.dropzone-title { font-size: 14.5px; font-weight: 500; margin: 0 0 5px; }
.dropzone-hint { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); letter-spacing: .08em; }

.queue { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.q-item {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
  padding: 12px 14px;
  border: 1px solid var(--hairline-soft);
  border-radius: 11px;
  background: var(--bg-deep);
}
.q-name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-status { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); letter-spacing: .06em; align-self: center; }
.q-status.is-ok { color: var(--ok); }
.q-status.is-err { color: var(--danger); }
.q-status.is-run { color: var(--amber); }
.q-bar {
  grid-column: 1 / -1;
  height: 3px; border-radius: 2px;
  background: var(--hairline-soft); overflow: hidden;
}
.q-bar-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--amber-dim), var(--amber));
  transition: width .3s var(--ease);
}

.video-admin-row {
  display: grid; grid-template-columns: 76px 1fr auto; gap: 12px;
  align-items: center;
  padding: 9px;
  border-radius: 10px;
  transition: background .2s var(--ease);
}
.video-admin-row:hover { background: var(--panel-hi); }
.va-thumb { aspect-ratio: 16/9; border-radius: 7px; overflow: hidden; background: #1B1B23; display: grid; place-items: center; }
.va-thumb img { width: 100%; height: 100%; object-fit: cover; }
.va-title { font-size: 13.5px; font-weight: 500; }
.va-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); margin-top: 3px; }

.hint {
  font-family: var(--mono); font-size: 10.5px; line-height: 1.7;
  color: var(--ink-faint); letter-spacing: .04em;
  margin: 12px 0 0;
}
.hint code {
  font-family: var(--mono);
  background: var(--bg-deep);
  border: 1px solid var(--hairline-soft);
  border-radius: 4px; padding: 1px 5px;
  color: var(--ink-dim);
}

/* ------------------------------ 弹层 ------------------------------ */

.modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: rgba(5,5,8,.78);
  backdrop-filter: blur(7px);
  padding: 20px;
  animation: fade .2s var(--ease);
}
.modal[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 30px 80px -30px #000;
}
.modal-title { font-family: var(--serif); font-weight: 400; font-size: 27px; margin: 0 0 10px; }
.modal-desc { font-size: 13.5px; color: var(--ink-dim); margin: 0 0 18px; }
.modal-desc code { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.modal-input { width: 100%; font-family: var(--mono); font-size: 14px;
  background: var(--bg-deep); border: 1px solid var(--hairline); border-radius: 9px;
  padding: 11px 13px; color: var(--ink); }
.modal-input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(255,122,24,.12); }
.modal-error { color: var(--danger); font-size: 12.5px; margin: 10px 0 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ------------------------------ 提示 ------------------------------ */

.toast-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 9px;
  max-width: min(400px, calc(100vw - 40px));
}
.toast {
  padding: 12px 16px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--amber);
  font-size: 13.5px;
  box-shadow: 0 16px 40px -18px #000;
  animation: slide-in .32s var(--ease);
}
.toast.is-error { border-left-color: var(--danger); }
.toast.is-ok { border-left-color: var(--ok); }
@keyframes slide-in {
  from { opacity: 0; transform: translateX(22px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------- 视图切换 --------------------------- */

::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: .26s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ============================================================
   响应式适配：手机 / 平板
   ============================================================ */

/* iOS 横屏时不要自动放大字号 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* 杜绝横向滚动条 */
body { overflow-x: hidden; }

/* 隐藏的文件输入框不能用 display:none —— iOS 上无法唤起系统选择器 */
.file-input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 去掉移动端点击时的灰色高亮框，并关闭 300ms 点击延迟 */
.btn, .icon-btn, .gear, .card, .pl-item, .coll-row, .dropzone {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ---------------------- 触屏：hover 反馈改为常驻 ---------------------- */

@media (hover: none) {
  /* hover 状态在触屏上会粘住，必须显式关掉 */
  .card:hover { transform: none; }
  .card:hover .card-cover img { transform: none; }
  .gear:hover { transform: none; }
  .gear:active { transform: rotate(90deg); }

  /* 靠 hover 才出现的操作入口，在触屏上永远露出来 */
  .card-play { opacity: 1; transform: none; }
  .coll-actions { opacity: 1; }
}

/* ---------------------- 平板与窄桌面 ---------------------- */

/* 1080px 以下：合集与控制台保持双列，只缩排版 */
@media (min-width: 641px) and (max-width: 1080px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
  .detail { grid-template-columns: minmax(0, 1.4fr) minmax(250px, .9fr); gap: 24px; }
  .console { grid-template-columns: minmax(270px, .85fr) minmax(0, 1.4fr); gap: 22px; }
}

/* 平板竖屏：详情与控制台塌成单列 */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .console { grid-template-columns: minmax(0, 1fr); }
  .playlist { max-height: 60vh; }
}

/* ---------------------- 手机：单列与紧凑排版 ---------------------- */

@media (max-width: 640px) {
  :root { --gutter: 16px; }

  /* 顶栏 */
  .topbar { gap: 12px; }
  .gear { width: 44px; height: 44px; border-radius: 12px; }
  .gear svg { width: 21px; height: 21px; }
  .wordmark-cn { font-size: 22px; }
  .wordmark-en { font-size: 9px; letter-spacing: .26em; }

  /* 区块标题 */
  .section-head {
    padding: 26px 0 18px;
    margin-bottom: 20px;
    gap: 10px;
  }
  .section-kicker { margin-bottom: 6px; letter-spacing: .24em; }
  .section-title { font-size: clamp(30px, 9vw, 42px); }
  .section-note { font-size: 10px; margin-bottom: 0; }

  /* 合集网格：单列，首张卡片的跨列破格要撤掉 */
  .grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .grid > .card:first-child { grid-column: span 1; }
  .card:first-child .card-cover { aspect-ratio: 16 / 9; }

  .card { border-radius: 14px; }
  .card-body { padding: 14px 16px 16px; }
  .card-title { font-size: 21px; }
  .card-desc { font-size: 13px; -webkit-line-clamp: 2; }
  .card-meta { font-size: 10px; }
  .card-index { top: 10px; left: 12px; font-size: 9px; }
  .card-play { right: 12px; bottom: 12px; width: 34px; height: 34px; }
  .card-initial { font-size: 56px; }

  /* 空态 */
  .empty { padding: 44px 20px; border-radius: 14px; }
  .empty-mark { font-size: 44px; margin-bottom: 12px; }
  .empty h2 { font-size: 23px; margin-bottom: 8px; }
  .empty p { font-size: 13.5px; margin-bottom: 20px; }

  /* 详情页 */
  .detail { padding-top: 18px; gap: 18px; }
  .detail-title { font-size: 25px; margin: 18px 0 6px; }
  .detail-desc { font-size: 13.5px; margin-bottom: 14px; }
  .detail-actions { gap: 8px; }
  .detail-actions .btn { flex: 1; justify-content: center; }

  .player-shell { border-radius: 12px; }
  .playlist { padding: 6px; max-height: none; }
  .pl-item { grid-template-columns: 72px 1fr; gap: 10px; padding: 6px; }
  .pl-title { font-size: 13px; }
  .pl-empty { padding: 28px 16px; font-size: 13px; }

  /* 管理控制台 */
  .console { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 18px; }
  .panel { border-radius: 14px; }
  .panel-head { padding: 13px 15px; }
  .panel-body { padding: 15px; }
  .row { flex-wrap: wrap; }
  .row > * { flex: 1 1 140px; }

  /* 输入框字号必须 ≥16px，否则 iOS 聚焦时会整页放大 */
  .input, .textarea, .select, .modal-input { font-size: 16px; }
  .textarea { min-height: 68px; }

  /* 上传区 */
  .dropzone { padding: 26px 14px; border-radius: 10px; }
  .dropzone-icon svg { width: 26px; height: 26px; }
  .dropzone-title { font-size: 14px; }
  .dropzone-hint { font-size: 10px; }

  /* 合集行 */
  .coll-row { padding: 10px; }
  .coll-row-title { font-size: 13.5px; }
  /* 触摸目标至少 36px，方便手指点按 */
  .icon-btn { width: 36px; height: 36px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .btn { min-height: 44px; padding: 12px 18px; }
  .btn-sm { min-height: 38px; padding: 9px 14px; }
  .icon-btn, .btn { touch-action: manipulation; }

  /* 视频管理行：改为可换行的 flex，标题不被挤扁 */
  .video-admin-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  }
  .video-admin-row > .va-thumb { width: 60px; flex: none; }
  .video-admin-row > div:nth-child(2) { flex: 1 1 140px; min-width: 0; }
  .video-admin-row > .coll-actions { flex: none; margin-left: auto; }
  .va-title { font-size: 13px; }

  /* 弹层：底部抽屉式 */
  .modal { padding: 14px; align-items: flex-end; }
  .modal-card {
    width: 100%; padding: 20px; border-radius: 18px;
    max-height: 86vh; overflow-y: auto;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
  .modal-title { font-size: 23px; }
  .modal-desc { font-size: 13px; margin-bottom: 14px; }
  .modal-actions { flex-direction: column; margin-top: 18px; }
  .modal-actions .btn { width: 100%; justify-content: center; }

  /* 提示条 */
  .toast-stack {
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: none;
  }
  .toast { font-size: 13px; padding: 11px 14px; }

  .boot { padding: 56px 0; font-size: 11px; }
  .hint { font-size: 10px; line-height: 1.65; }

  /* 移动端滚动性能：fixed 背景 + 混合模式颗粒都会造成掉帧 */
  body { background-attachment: scroll; }
  body::after { opacity: .18; }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none;
    background: rgba(11,11,15,.96); }
}

/* ---------------------- 手机横屏 ---------------------- */

@media (max-height: 500px) and (orientation: landscape) {
  .section-head { padding: 18px 0 12px; margin-bottom: 16px; }
  .section-title { font-size: clamp(26px, 5vw, 36px); }
  .detail { padding-top: 14px; gap: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(220px, .9fr); }
  .playlist { max-height: 72vh; }
  .empty { padding: 30px 20px; }
  .boot { padding: 36px 0; }
}

/* ---------------------- 超宽屏 ---------------------- */

@media (min-width: 1600px) {
  .app { max-width: 1680px; }
}
