:root {
  --bg: #0e0f13; --panel: #161820; --panel-2: #1d2029; --line: #2a2d38; --text: #eceef3; --muted: #9aa0ad;
  --accent: #8b5cf6; --accent-2: #a78bfa; --good: #34d399; --bad: #f87171; --rec: #ef4444;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; }
a { color: var(--accent-2); text-decoration: none; }
.muted { color: var(--muted); }
.pad { padding: 24px; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.logo { color: var(--text); font-weight: 750; letter-spacing: .01em; }
.logo::first-letter { color: var(--rec); }
.nav nav { display: flex; gap: 10px; align-items: center; }
.nav nav a:not(.btn) { color: var(--muted); padding: 6px 10px; }
.btn, button { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { border-color: #3a3e4c; }
button:disabled { opacity: .45; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.danger { color: var(--bad); }
.rec-btn { background: var(--rec); border-color: var(--rec); color: #fff; }
input, select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.page { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 22px; }

/* library */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--text); display: block; }
.card:hover { border-color: #3a3e4c; }
.thumb { aspect-ratio: 16/9; background: #000 center/cover no-repeat; position: relative; }
.thumb .d { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.7); padding: 1px 7px; border-radius: 6px; font-size: 12px; }
.card .b { padding: 10px 12px 12px; }
.card .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stats b { color: var(--text); font-weight: 600; }
.empty { text-align: center; padding: 70px 20px; border: 1px dashed var(--line); border-radius: 14px; }

/* recorder */
.recbox { max-width: 640px; margin: 30px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.recbox h1 { margin: 0 0 4px; font-size: 20px; }
.row { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.row label { min-width: 110px; color: var(--muted); }
.row select { flex: 1; min-width: 180px; }
.meter { height: 6px; flex: 1; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; width: 0; background: var(--good); transition: width .08s; }
.camprev { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; transform: scaleX(-1); background: #000; border: 3px solid var(--accent); }
.bigtime { font-size: 46px; font-variant-numeric: tabular-nums; font-weight: 700; text-align: center; margin: 10px 0; }
.bigtime.rec::before { content: "● "; color: var(--rec); }
.center { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.note { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; color: var(--muted); font-size: 13px; }
.progress { height: 8px; background: var(--line); border-radius: 5px; overflow: hidden; margin: 12px 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* video page */
.vp { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; }
@media (max-width: 980px) { .vp { grid-template-columns: 1fr; } }
.titlein { font-size: 20px; font-weight: 650; background: transparent; border-color: transparent; padding: 4px 8px; margin-left: -8px; flex: 1; min-width: 200px; }
.titlein:hover { border-color: var(--line); }
.stage { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; }
.stage video { width: 100%; height: 100%; display: block; object-fit: contain; }
.ctrl { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.tm { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 96px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px 10px 0 0; }
.tools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.tools button { padding: 5px 9px; font-size: 13px; }
kbd { font: 11px ui-monospace, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-left: 4px; color: var(--muted); }
.stripwrap { background: var(--panel); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; padding: 12px; }
.strip { display: flex; gap: 3px; height: 62px; position: relative; user-select: none; touch-action: none; }
.seg { position: relative; flex-basis: 0; min-width: 34px; background: linear-gradient(#3b2f6b, #2c2450); border: 1px solid #5b4aa3; border-radius: 7px; cursor: grab; overflow: hidden; background-size: cover; }
.seg.sel { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2) inset; }
.seg.drop-before { box-shadow: -4px 0 0 0 var(--good); }
.seg .lbl { position: absolute; left: 12px; right: 12px; top: 6px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; color: #ddd6fe; }
.seg .len { position: absolute; left: 12px; bottom: 5px; font-size: 11px; color: var(--muted); pointer-events: none; }
.seg .h { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; background: rgba(167,139,250,.35); }
.seg .h:hover, .seg .h.on { background: var(--accent-2); }
.seg .h.l { left: 0; } .seg .h.r { right: 0; }
.playhead { position: absolute; top: -6px; bottom: -6px; width: 2px; background: #fff; pointer-events: none; z-index: 3; }
.mark { position: absolute; top: -8px; bottom: -8px; width: 2px; background: var(--good); z-index: 2; pointer-events: none; }
.markzone { position: absolute; top: 0; bottom: 0; background: rgba(248,113,113,.28); z-index: 2; pointer-events: none; border-radius: 4px; }
.striphint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.side { display: flex; flex-direction: column; gap: 14px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.box h3 { margin: 0 0 10px; font-size: 14px; }
.newlink { display: flex; gap: 6px; }
.newlink input { flex: 1; min-width: 0; }
.link { border-top: 1px solid var(--line); padding: 10px 0; }
.link:first-of-type { border-top: 0; }
.link .lt { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.link .who { font-weight: 600; }
.link .url { font: 12px ui-monospace, monospace; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link.fresh { background: rgba(139,92,246,.12); border-radius: 8px; padding: 10px 8px; }
.link.off { opacity: .45; }
.mini { padding: 3px 8px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.me td { opacity: .5; }
.pbar { display: inline-block; width: 70px; height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.pbar i { display: block; height: 100%; background: var(--accent); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.tablewrap { overflow-x: auto; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #262934; border: 1px solid var(--line); padding: 9px 16px; border-radius: 10px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.login { max-width: 340px; margin: 14vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.saved { color: var(--muted); font-size: 12.5px; }
.saved.dirty { color: #fbbf24; }
@media (max-width: 560px) { .page { padding: 16px; } .nav { padding: 10px 16px; } }
[hidden] { display: none !important; }
