:root {
  --bg: #0b0c10;
  --panel: #12141a;
  --panel-2: #171a22;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #e9ebf1;
  --text-2: #a4a9b6;
  --text-3: #6b7080;
  --accent: #7aa2ff;
  --accent-2: #b4c8ff;
  --accent-soft: rgba(122, 162, 255, 0.14);
  --ok: #5fd39a;
  --warn: #f3b955;
  --warn-soft: rgba(243, 185, 85, 0.1);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, 0.12);
  --douyin: #2af0ea;
  --xhs: #ff2e4d;
  --bili: #fb7299;
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.muted { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.boot { position: fixed; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.safe-top { height: env(safe-area-inset-top); }

.app { max-width: 1240px; margin: 0 auto; padding: 22px 32px 64px; }

/* 顶栏 */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 2px 0 26px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #0b0c10; background: linear-gradient(140deg, var(--accent-2), var(--accent)); flex: none; }
.brand h1 { font-size: 20px; font-weight: 650; letter-spacing: 0.02em; white-space: nowrap; }
.plats { display: flex; gap: 6px; margin-left: 6px; }
.plats i, .badge { font-style: normal; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); color: var(--text-2); white-space: nowrap; }
.plats i::before, .badge::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--c); }
.p-douyin { --c: var(--douyin); }
.p-xhs { --c: var(--xhs); }
.p-bilibili { --c: var(--bili); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--text-2); flex: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }

/* 按钮 */
.btn { height: 40px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-weight: 550; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; color: var(--text); }
.btn:hover { border-color: rgba(255, 255, 255, 0.22); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b0c10; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ready { background: var(--ok); border-color: var(--ok); color: #0b0c10; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { box-shadow: 0 0 0 5px rgba(95, 211, 154, 0.18); } }
.link-btn { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 4px 0; font-size: 13px; }
.link-btn:hover { color: var(--text-2); text-decoration: underline; }

/* 粘贴框 */
.add { display: flex; gap: 10px; align-items: flex-end; padding: 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line-2); transition: border-color .15s, box-shadow .15s; }
.add:focus-within { border-color: rgba(122, 162, 255, 0.5); box-shadow: 0 0 0 4px rgba(122, 162, 255, 0.08); }
.add textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; padding: 9px 10px; font-size: 16px; line-height: 22px; max-height: 120px; }
.add textarea::placeholder { color: var(--text-3); }
.add-btns { display: flex; gap: 8px; flex: none; }
.add .btn { height: 42px; }
.add .btn.primary { min-width: 92px; }
.add-msg { margin: 10px 4px 0; color: var(--bad); font-size: 13px; }
.hint { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); border: 1px solid rgba(243, 185, 85, 0.22); color: #f6d9a3; font-size: 13px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.hint button { flex: none; }

/* 列表 */
.list-wrap { margin-top: 34px; }
.list-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.list-head h2 { font-size: 15px; font-weight: 650; }
.list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.empty { padding: 56px 20px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--text-2); display: grid; gap: 6px; }

.card { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); min-height: 176px; }
.card.is-failed { border-color: rgba(255, 107, 107, 0.22); }
.thumb { position: relative; width: 112px; height: 148px; border-radius: 10px; overflow: hidden; background: var(--panel-2); border: 0; padding: 0; cursor: default; align-self: start; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.playable { cursor: pointer; }
.thumb.playable::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(0,0,0,.35) 0, rgba(0,0,0,.35) 21px, transparent 22px); }
.thumb.playable::before { content: ""; position: absolute; z-index: 1; left: 50%; top: 50%; margin: -8px 0 0 -5px; border-left: 14px solid #fff; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 12px; }
.c-main { display: flex; flex-direction: column; min-width: 0; }
.c-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.c-time { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.c-title { font-size: 15px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.c-author { color: var(--text-2); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-specs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.spec { font-size: 12px; padding: 1px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); color: var(--text-2); font-variant-numeric: tabular-nums; }
.spec.hi { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.c-note { margin-top: 8px; font-size: 12.5px; color: #f6d9a3; }
.c-note::before { content: "! "; font-weight: 700; color: var(--warn); }
.c-err { margin-top: 8px; font-size: 13px; color: #ffb3b3; }
.c-status { margin-top: 10px; font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.bar { margin-top: 6px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.bar.indet i { width: 35% !important; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.c-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; }
.c-acts .del { margin-left: auto; }
.btn.icon { width: 34px; padding: 0; color: var(--text-3); }
.btn.icon:hover { color: var(--bad); }
.c-tip { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.c-tip.ok { color: var(--ok); }
.link-btn.inline { padding: 0 2px; color: var(--accent-2); font-size: inherit; text-decoration: underline; }

/* 设置 */
.sheet { position: fixed; inset: 0; z-index: 30; }
.sheet-scrim, .player-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); }
.sheet-body { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100%); overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line-2); padding: calc(18px + env(safe-area-inset-top)) 24px 40px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.sheet-head h3 { font-size: 17px; }
.s-sec { padding: 18px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.s-sec h4 { font-size: 14px; }
.s-intro { font-size: 13px; }
.ck { padding: 12px; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); display: grid; gap: 8px; margin-bottom: 10px; }
.ck-head { display: flex; align-items: center; gap: 8px; }
.ck-state { font-size: 12.5px; color: var(--text-3); margin-left: auto; text-align: right; }
.ck-state.on { color: var(--ok); }
.ck-state.off-bad { color: var(--warn); }
.ck textarea { width: 100%; min-height: 64px; resize: vertical; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); padding: 8px 10px; font-size: 13px; font-family: ui-monospace, Menlo, monospace; outline: 0; }
.ck textarea:focus { border-color: rgba(122, 162, 255, 0.5); }
.ck-row { display: flex; gap: 8px; align-items: center; }
.ck-row .muted { font-size: 12px; }
.howto { font-size: 13px; color: var(--text-2); }
.howto summary { cursor: pointer; color: var(--accent-2); }
.howto ol { padding-left: 20px; margin: 10px 0; display: grid; gap: 6px; }
.howto code { background: rgba(255,255,255,.07); padding: 0 5px; border-radius: 4px; }
.acct { display: grid; gap: 10px; }
.acct label { display: grid; gap: 5px; font-size: 13px; color: var(--text-2); }
.acct input, .login-fields input { height: 40px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 12px; font-size: 15px; outline: 0; }
.acct input:focus, .login-fields input:focus { border-color: rgba(122, 162, 255, 0.5); }
.acct-row { display: flex; align-items: center; gap: 12px; }

/* 登录 */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(360px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-fields { display: grid; gap: 6px; }
.login-fields label { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.login-fields p { font-size: 13px; color: var(--text-2); }
.err { color: var(--bad); font-size: 13px; text-align: center; }

/* 播放 */
.player { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; }
.player video { position: relative; max-width: 94vw; max-height: 88vh; border-radius: 12px; background: #000; }
.player-x { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 10px; background: #23262f; border: 1px solid var(--line-2); box-shadow: 0 8px 30px rgba(0,0,0,.4); font-size: 13.5px; max-width: calc(100vw - 32px); }

/* 手机 */
@media (max-width: 760px) {
  .app { padding: 12px 14px 48px; }
  .top { padding-bottom: 16px; }
  .plats { display: none; }
  .list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .list-wrap { margin-top: 26px; }
  .card { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 12px; min-height: 0; }
  .thumb { width: 88px; height: 118px; }
  .c-title { font-size: 14.5px; }
  .c-acts .btn { flex: 1; }
  .c-acts .del { flex: none; margin-left: 0; }
  .c-acts .btn.icon { width: 34px; }
  .add { flex-direction: column; align-items: stretch; }
  .add-btns .btn { flex: 1; }
  .sheet-body { padding-left: 16px; padding-right: 16px; }
}
